Behold, it is written by them of old time that you shall not commit adultery. But I say unto you that whoever looks on a woman to lust after her has committed adultery with her already in his heart. Behold, I give unto you a commandment that you suffer none of these things to enter into your heart; for it is better that you should deny yourselves of these things, wherein you will take up your cross, than that you should be cast into hell.
Wherefore, if your right eye offend you, pluck it out and cast it from yourself; for it is profitable for you that one of your members should perish, and not that your whole body should be cast into hell. Or if your right hand offend you, cut it off and cast it from yourself; for it is profitable for you that one of your members should perish, and not that your whole body should be cast into hell. And now this I speak, a parable concerning your sins; wherefore, cast them from you that you may not be hewn down and cast into the fire.
It has been written that whoever shall divorce his wife, let him give her a writing of divorcement. Truly, truly I say unto you that whoever shall divorce his wife, saving for the cause of fornication, causes her to commit adultery. And whoever shall marry her that is divorced commits adultery. (Matthew 5:27-32)
A more correct translation of this verse would be as follows:
Remember also, it was written since ancient time that you shall not commit adultery; but I say to you that anyone who engages in deliberate planning to seduce a woman to sin sexually has already omitted adultery in his heart. Hear now: I command you to not let any of these things enter your heart, for it's better to stop doing any of these things, and carry your own cross, rather than be cast into hell.
To look on a woman to lust after her means the actual scheming or mental planning to engage or seduce. It is not just a passing biological attraction that is subdued by one’s will to obey God, nor is it a whispered temptation from a mischievous spirit. Subduing and rejecting that temptation is part of living righteously.
Adultery is a serious transgression of God's will and commandments. It is second only to murder and denying the holy ghost. Members of Christ's church can repent of adultery but not endlessly. Those that commit adultery but repent with all their hearts who are forgiven but then do so again are not forgiven and are cut off from Christ's church.
So serious is this topic that God gave a commandment to subdue such thoughts in our heart so that it never results in the action. The consequence of looking on a woman to lust after them serious as well. Those that do this will not have Christ's spirit and will deny the faith and shall fear.
Flee fornication. Every sin that a man commits is against the body of Christ, and he who commits fornication sins against his own body. What? Do you not know that your body is the temple of the holy ghost which is in you, which you have of God? And you are not your own, for you are bought with a price. Therefore, glorify God in your body and in your spirit, which are God’s. (1 Corinthians 6:13-20)
God delights in the chastity of men and women prior to marriage and in fidelity to their spouse after marriage. Sexual relations outside of marriage are contrary to God's commandments. Looking at someone with the intent to sexually engage or seduce them prior to marriage is contrary to God's commandments. Subdue such thoughts and desires in your heart and mind.