Guidance for marriage can be found throughout the Bible. Paul’s first letter to the Corinthians includes advice for married couples, widows and those who are unmarried.
To the married I give this charge (not I, but the Lord): the wife should not separate from her husband (but if she does, she should remain unmarried or else be reconciled to her husband), and the husband should not divorce the wife. (1 Corinthians 7:10-11)
This passage reiterates the guidance God has given in regards to marriage and divorce. For further reading on this topic in the Bible please see Genesis 2:24, Matthew 19:1-12 (parallel account; Mark 10:1-12) and Ephesians 5:22-33.
Jesus gives a clear message about divorce, “What therefore God has joined together, let not man separate.” (Matthew 19:6) but also recognises that there are situations when people may divorce due to the sexually immoral behaviour of a spouse (Matthew 5:32 & 19:9).
Sexual immorality is probably one of the reasons behind the mass divorce recorded in Ezra 9 & 10. The people of Israel had returned from Persian captivity and intermarried with people of the surrounding nations. The Old Testament records that the surrounding nations practiced idolatry (Deuteronomy 7:25), sexual immorality (Numbers 25:1-9) and even child sacrifice (Deuteronomy 12:30-31). God supported this divorce (Ezra 10:11) and does not want his children to be subject to such abusive and destructive behaviour.
Paul gives the following advice to people who have an unbelieving spouse:
To the rest I say (I, not the Lord) that if any brother has a wife who is an unbeliever, and she consents to live with him, he should not divorce her. If any woman has a husband who is an unbeliever, and he consents to live with her, she should not divorce him…But if the unbelieving partner separates, let it be so. In such cases the brother and sister is not enslaved. God has called you to peace… (1 Corinthians 7:12-15)
Peter in his first letter provides further advice to those in a marriage relationship that involves a spouse who does not obey God’s word. It is directed to wives but also applies to husbands:
…wives, be subject to your own husbands, so that even if some do not obey the word, they may be won without a word by the conduct of their wives — when they see your respectful and pure conduct. (1 Peter 3:1-2)
In conclusion, God wants married couples to stay together. He also acknowledges that separation does occur (particularly mentioning sexual immorality as a reason for this) and that sometimes it may be best for a person’s safety or spiritual well being.