What is the meaning of Matthew 5:27-28?

27 Ye have heard that it was said by them of old time, Thou shalt not commit adultery: 28 But I say unto you, That whosoever looketh on a woman to lust after her hath committed adultery with her already in his heart. (Matthew 5:27-28 KJV)

William Burkitt’s Commentary

Our Savior next proceeds to explain the seventh commandment, which forbids adultery; by which the Pharisees understood only the gross act of uncleanness, and carnal lying with a woman. But, says our Savior, Whosoever secretly in his heart desires such a thing, and casts his eyes upon a woman in order to such an act, entertaining only a thought of it with pleasure and delight, he is an adulterer in God’s account.  

Learn, That such is the purity and spirituality of the law of God, that it condemns speculative wantonness, no less than practical uncleanness; and forbids not only the outward action, but the secret purpose and intention, and first out-goings of the soul after unlawful objects.

Thomas Scott’s Commentary

Verses 27-28: The Pharisees interpreted the seventh commandment merely as a prohibition of actual adultery with a married woman; but Christ showed that is spiritual import reached to the thoughts and desires of the heart.

For instance, if a man should allow himself to gaze at a women, in order that thoughts of a criminal intercourse might be excited, or till they were; he would be deemed an adulterer in his heart, and deserve the punishment denounced against adulterers: and his guilt would be still more aggravated, if he indulged the licentious imagination, and actually purposed or devised means for gratifying his desires, though he should by any means be prevented.

We cannot suppose that this prohibits a man from looking at a woman whom he may lawfully marry, with such a predilection as to desire to possess her in marriage. The inclination for that which is not sinful can only become sinful by being inordinate; but it may be, and, alas! commonly is. Eze 20:14 —‘The expositors of the law said, If a man sees a woman whom he loves better than his wife; let him divorce his wife and marry her.’—Jerome. This is a specimen of Rabbinical morality!