This is one of the questions sparked in a evangelistic message by Ray Comfort. The first time I heard this expressed I was surprised myself to hear what the bible had to say on this matter.
Wikipedia defines adultery as
Adultery is generally defined as consensual sexual intercourse by a married person with someone other than his or her lawful spouse. In many jurisdictions, an unmarried person who is sexually involved with a married person is also considered an adulterer. The common synonym for adultery is infidelity as well as unfaithfulness or in colloquial speech, cheating. It was also known in earlier times by the legalistic term "alienation of affection"
Adultery is also found to be one of the ten commandments. It is the seventh commandemnt , 7. Thou shalt not commit adultery.
So the core of the matter is how does the bible define adultery. We clearly see the answer found in the New Testament by Jesus Himself.
(Matthew 5:27-28 NKJV) "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."
Wow, when this was first clarified to me, I found myself in sin as well, breaking one of the ten commandments. Those that break just one of the ten commandments will be found as unrighteous. They have broken the law of God.
Please note adultery is different than fornication. Fornication is sex for those not in marriage, while adultery is sex (or lust after another) while in marriage.
1 Corinthians chapter 6 verse 9 and 10 states;
Do you not know that the unrighteous will not inherit the kingdom of God? Do not be deceived,. Neither fornicators, nor idolaters, nor homosexuals, nor sodomites, nor thieves nor covetous, nor drunkards, nor revilers, nor extortioners, will inherit the kingdom of God.
If all the above and those that break the ten commandments will not inherit the kingdom of God, ie get into heaven, then who can?
John chapter 3 verse 15, 16 and 17 tells us the answer.
that whoever believes in Him should not perish but have eternal life. For God so loved the world that he gave His only begotten Son, that whoever believes in Him should not perish but have everlasting life. For God did not send His Son into the world to condemen the world, but that the world through Him might be saved.
That is the key to being saved. Accepting Christ gift of repentance. Know you are a sinner, transgressor (law breaker), accept Christ gift and believe in Him.
A final thing to point out. Notice the last part of the last sentence in verse 17. "..that the world through Him might be saved." Might be saved. Why wouldn't the whole world be saved by His sacrifice? Because it takes our own individual choice to accept His sacrifice.