To answer this question, we need to go right to the very beginning of the Bible. In Genesis 1-2 God made the whole universe, which obviously included men and women (Gen 1:26-29). Genesis 2 focuses on the creation of men and women in more detail (as well as their God given roles). In chapter 2, God created Adam first (2:7), and then Eve (2:18, 20b-22). Adam’s response when he meets the first woman is in verse 23:
This at last is bone of my bones and flesh of my flesh; she shall be called Woman, because she was taken out of Man. (ESV)
The author of Genesis then draws out an implication from this in verse 24:
Therefore a man shall leave his father and his mother and hold fast to his wife, and they shall become one flesh.
These verses are saying that given the nature of men and women, a man will leave his family and be united to his wife in marriage (forming a new family unit), and that they shall become one flesh. Becoming one flesh is the result of both being married and of sex. In other words the two go together, and both are “very good” (cf. Genesis 1:31).
Let’s look at this in a bit more detail. In 1 Corinthians 6:12-20 Paul is addressing an error in the Corinthian church. They were saying something like: “everything is permissible for me” (1 Corinthians 6:12), and using it to justify sex outside of marriage, specifically sex with a prostitute (1 Corinthians 6:15-16). These verses are key, because they tell us God’s purpose for sex:
Do you not know that your bodies are members of Christ? Shall I then take the members of Christ and make them members of a prostitute? Never! 16 Or do you not know that he who is joined to a prostitute becomes one body with her? For, as it is written, “The two will become one flesh.” 17 But he who is joined to the Lord becomes one spirit with him. (1 Corinthians 6:15-17)
Paul’s argument is that as Christians, the Corinthians are united to Christ: their bodies belong to him. Paul then asks, if your bodies belong to Christ, how can you give them to a prostitute? In verse 16, we see the effect (and purpose) of sex: it units people together; it makes them “one flesh.” Paul’s challenge to the Corinthians is how can you unite yourselves to a prostitute by sex (who has nothing to do with Christ), and be united to Christ at the same time?
From these verses, the purpose of sex is clear: it is to unite a man and women together. Indeed, every time they have sex together they are reinforcing their unity. This is why it goes hand in hand with marriage, because in marriage a men and wife have publically expressed their sole commitment to one another – they are united together, and sex expresses that unity.
Therefore, in the Bible, sexual immorality refers to any kind of sexual activity outside of marriage between one man and one women. Paul’s conclusion to his argument in 1 Corinthians 6 is in verse 18-20:
Flee from sexual immorality. Every other sin a person commits is outside the body, but the sexually immoral person sins against his own body. 19 Or do you not know that your body is a temple of the Holy Spirit within you, whom you have from God? You are not your own, 20 for you were bought with a price. So glorify God in your body.
Given what Paul has just said about sex in the previous verses, his command to “flee sexual immorality” is not surprising. It is also important to remember who we are: Christians are those whom God has bought at a great price (the cost of Jesus’ death on the Cross), and they are the temple of the Holy Spirit. As such, our bodies must be used for what is holy, not what is impure. As Paul says, “glorify God with your body.”
Marriage still holy?
Let me now address the second part of your question: is marriage still holy when neither person is a virgin. If the couple involved in the marriage are Christians and are truly sorry (repentant) for their past sins, then the marriage is just as holy as one with two virgins. Paul’s comments in 1 Corinthians 6:9-11 are helpful here:
For do you not know that the unrighteous will not inherit the kingdom of God? Do not be deceived: neither the sexually immoral, nor idolaters, nor adulterers, nor men who practice homosexuality, 10 nor thieves, nor the greedy, nor drunkards, nor revilers, nor swindlers will inherit the kingdom of God. 11 And such were some of you. But you were washed, you were sanctified, you were justified in the name of the Lord Jesus Christ and by the Spirit of our God.
In verse 11, Paul says that some of the Corinthians were sexually immoral, but that in Christ they have been washed, sanctified (made holy), and justified (made right with God). Therefore, no matter what past sexual sins have been committed, in Christ there is cleansing and forgiveness. But equally the fact that God has (and will) forgive sin, mustn’t be used to justify further sin. Remember Paul’s comment in 1 Corinthians 6:18: “flee from sexual immorality.”