Hosea 1:2
2 The beginning of the word of the LORD by Hosea. And the LORD said to Hosea, Go, take unto thee a wife of whoredoms and children of whoredoms: for the land hath committed great whoredom, departing from the LORD.
How could a holy God who condemns harlotry command Hosea to marry a harlot?
PROBLEM: God commanded Hosea to “take yourself a wife of harlotry.” However, according to Exodus 20:14, adultery is a sin; and according to 1 Corinthians 6:15-18, to have sexual relations with a harlot is immoral (cf. Leviticus 19:29). How could a holy God command Hosea to take a harlot as his wife?
SOLUTION: Some scholars have attempted to avoid the difficulty by claiming this is an allegory. However, while God obviously intended this as a dramatic illustration to Israel of their unfaithfulness to Him (cf. 1:2), there is no indication in the text that it is anything but a literal event. How else could it have been such a forceful example to the wayward people of Israel. Taken literally, there is no real contradiction with any other Scripture for several reasons.
First of all, when God commanded Hosea to take Gomer, the daughter of Diblaim, to be his wife, Gomer may not yet have actually committed adultery. However, God knew what was in her heart, and He knew that she would ultimately be unfaithful to Hosea. This is similar to the angel of the Lord calling Gideon a “mighty man of valor” before he had fought a single battle (Judges 6:11-12). God knew that Gideon would become a great leader in Israel even though he was not yet. God commanded Hosea to take a woman whom He knew would become a harlot. God commanded this as a picture of how Israel had committed spiritual adultery against Him. When God brought Israel out of Egypt, she was a brand new nation. She had not yet broken the covenant which God would establish with her in the wilderness. Just like Israel had committed spiritual adultery by worshiping other gods, so Gomer would commit physical adultery by having relations with other men. The relationship between Hosea and Gomer was an object lesson for all Israel.
Fourth, the command in Leviticus 21:14 to not marry a harlot was given to the levitical priests, not to everyone. Salmon apparently married Rahab the harlot (Matthew 1:5) from whose legal genealogy Christ eventually came. At any rate, Hosea was a prophet, not a levitical priest, hence, the prohibition to not marry a harlot did not apply to him.
Finally, the command in 1 Corinthians 6:16 not to be joined to a harlot is not a command never to marry a woman who was a harlot. Rather, the command is directed against those who were having sexual relations outside of the marriage relationship. But, Hosea did not have sexual relations outside of marriage. God commanded Hosea to marry Gomer and always be faithful to her.