Jesus was able to perceive her need as part of the miracle of her healing.
Our Lord, who came to ransom the race of sinners, was free from sin, and was free also from pain, sickness and death. So, whenever he experienced these, he did so by his own consent – a sacrifice on our behalf.
The penalty of our sins was death; the sickness and pain were only incidentals. Our redemption price was fully paid by our Lord’s death. But it was the will of Jehovah to bruise him – to allow him to have an experience with pain, sorrow, etc. – as well as to make his soul (being, existence) an offering for sin. (Isaiah 53:10).
Since he could not suffer pain and sickness due to his own sin, he was placed for a time among sinners. Here his full, generous, loving sympathy for the poor and sick and miserable would lead him to spend for others his own vital energy. When “virtue (vitality – healing vigor, literally power) went out of him” to the sick (Luke 6:19; 8:46) their weaknesses and pains bore down upon him. It was in this way that “himself took our infirmities and bare our sicknesses.” (Matthew 8:17, Isaiah 53:4,5). Thus, he was “touched with a feeling of our infirmities” (Hebrews 4:15). In this way, he is able to be a “sympathetic high priest” (Hebrews 4:14-16).