God does not approve of prostitution, but he told Hosea to marry a prostitute so that the message of Israel's unfaithfulness would be shown to the people. (See: [[rc://en/tw/dict/bible/kt/faithful]])
Hosea's marriage to Gomer is a metaphor for the kingdom of Israel's relationship to Yahweh. Israel was unfaithful to Yahweh and broke the covenant with him. Gomer was a woman who was unfaithful to her husband broke her marriage agreement with him. (See: [[rc://en/ta/man/jit/figs-metaphor]] and [[rc://en/tw/dict/bible/kt/covenant]])
Hosea 1-4 is controlled by a metaphor that Hosea lived out. He was personifying the relationship between Israel and Yahweh. Hosea played the part of Yahweh, and Gomer played the part of Israel.