In Hosea chapter 2, God describes the whole of His relationship with His people in marriage language, specifically, adulterous marriage language. It’s not the rawest language in the Bible (that’s probably reserved for Ezekiel), but it’s pretty blunt.
God, as a spurned husband, is not what we would call gracious. He determines to ruin and embarrass his wife, exposing her behavior and crushing her to the extent that she finds herself enslaved.
How can an all good God behave like this?
Our own culture tends to think little of adultery. The ubiquity of such behavior among people of power has made it a crime only to the wronged. We sympathize with the spouse whose partner cheats, but we’ll excuse the cheater (sometimes by voting for him/her).
But God’s view is not so lax. Consider this: When God talks about people being unfaithful to him, the strongest language He has in His vocabulary is “adultery.” Whether spiritual or physical, neither is a small nor insignificant matter with the Lord. A good God demands goodness, and unfaithfulness is not to be tolerated.
One other observation: Sometimes folks regard sexual misconduct before marriage as different from sexual misconduct after marriage. God does not. In the illustration of Hosea and Gomer, Gomer is presented as an “adulterous wife” before her marriage to Hosea. Newer translations call her “promiscuous.” What a person is before marriage is part of one’s character. It’s not likely to be eradicated with a wedding.