Thank you for asking a question on www.thisisyourbible.com
In the Old Testament
Adultery was prohibited in the 10 Commandments given through Moses.
Exodus 20:14 You shall not commit adultery.
The punishment for adultery under the Law given through Moses was death.
Leviticus 20:10 The man who commits adultery with another man’s wife, he who commits adultery with his neighbor’s wife, the adulterer and the adulteress, shall surely be put to death.
Deuteronomy 22:22 If a man is found lying with a woman married to a husband, then both of them shall die—the man that lay with the woman, and the woman; so you shall put away the evil from Israel.
Proverbs 6:32 Whoever commits adultery with a woman lacks understanding; He who does so destroys his own soul.
In the New Testament
Lust is the precursor to adultery.
Matthew 5:27 You have heard that it was said to those of old, ‘You shall not commit adultery. 28 But I say to you that whoever looks at a woman to lust for her has already committed adultery with her in his heart.
In Christ, divorce and remarriage, except where the other party has committed adultery, constitute adultery.
Mark 10:11 ...He said to them, "Whoever divorces his wife and marries another commits adultery against her. 12 "And if a woman divorces her husband and marries another, she commits adultery."
Matthew 5:32 But I say to you that whoever divorces his wife for any reason except sexual immorality causes her to commit adultery; and whoever marries a woman who is divorced commits adultery.
‘You shall not commit adultery’ is a commandment to be kept if we want eternal life.
Matthew 19:16 ...if you want to enter into life, keep the commandments." 18 He said to Him, "Which ones?" Jesus said, "‘You shall not murder,’ ‘You shall not commit adultery,’ ‘You shall not steal,’ ‘You shall not bear false witness,’ 19 ‘Honor your father and your mother,’ and, ‘You shall love your neighbor as yourself.’"
Adultery breaks the commandment of Christ to love our neighbour as ourselves.
Romans 13:9 For the commandments, "You shall not commit adultery," "You shall not murder," "You shall not steal," "You shall not bear false witness," "You shall not covet," and if there is any other commandment, are all summed up in this saying, namely, "You shall love your neighbor as yourself."
Adultery if unrepented of and unforgiven will exclude from the kingdom of God.
Galatians 5:19 Now the works of the flesh are evident, which are: adultery, fornication, uncleanness, lewdness, 21 envy, murders, drunkenness, revelries, and the like; of which I tell you beforehand, just as I also told you in time past, that those who practice such things will not inherit the kingdom of God.
Adultery can be forgiven if we repent, are baptised by immersion into Christ for the remission of sins and we live the rest of our lives by the commandments of Christ.
1 Corinthians 15:3 For I delivered unto you first of all that which I also received, how that Christ died for our sins according to the scriptures;
Galatians 1:4 Who gave himself for our sins, that he might deliver us from this present evil world, according to the will of God and our Father:
1 John 2:2 And he is the propitiation for our sins: and not for ours only, but also for the sins of the whole world.
1 John 4:10 Herein is love, not that we loved God, but that he loved us, and sent his Son to be the propitiation for our sins.
Luke 24:46 Then He said to them, "Thus it is written, and thus it was necessary for the Christ to suffer and to rise from the dead the third day, 47 "and that repentance and remission of sins should be preached in His name to all nations, beginning at Jerusalem.
Acts 3:19 "Repent therefore and be converted, that your sins may be blotted out, so that times of refreshing may come from the presence of the Lord,
Acts 2:38 Then Peter said to them, "Repent, and let every one of you be baptized in the name of Jesus Christ for the remission of sins;
1 Corinthians 15:9 Do you not know that the unrighteous will not inherit the kingdom of God? Do not be deceived...nor adulterers... will inherit the kingdom of God. 11 And such were some of you. But you were washed, but you were sanctified, but you were justified in the name of the Lord Jesus and by the Spirit of our God.
The commandments of Christ:
Matthew 22:37 Jesus said to him, "‘You shall love the LORD your God with all your heart, with all your soul, and with all your mind.’ 38 "This is the first and great commandment. 39 "And the second is like it: ‘You shall love your neighbor as yourself.’
Our neighbour includes our enemy.
Matthew 5:44 But I say unto you, Love your enemies, bless them that curse you, do good to them that hate you, and pray for them which despitefully use you, and persecute you;
I hope this helps.