What does Matthew 5:27 mean?

Matthew 5:27 KJV
Ye have heard that it was said by them of old time, Thou shalt not commit adultery:

Matthew 5:27 NKJV
“You have heard that it was said to those of old, ‘You shall not commit adultery.’

Matthew 5:27 MKJV
You have heard that it was said to the ancients, “You shall not commit adultery.”

Matthew 5:27 KJV 2000
You have heard that it was said by them of old time, You shall not commit adultery:

Interlinear KJV

Ye have heard /akouo/ that /hoti/ it was said /rheo/ by them of old time, /archaios/ Thou shalt /moicheuo/ not /ou/ commit adultery: /moicheuo/

Albert Barnes’ Commentary

The Same Subject Illustrated from the Seventh Commandment (Mt 5:27-32).

27. Ye have heard that it was said–The words “by,” or “to them of old time,” in this verse are insufficiently supported, and probably were not in the original text.

Thou shall not commit adultery–Interpreting this seventh, as they did the sixth commandment, the traditional perverters of the law restricted the breach of it to acts of criminal intercourse between, or with, married persons exclusively. Our Lord now dissipates such delusions.