|“|| Exodus 20:14 Thou shalt not commit adultery.
Deuteronomy 5:18 Neither shalt thou commit adultery.
Hebrews 13:4 Marriage is honourable in all, and the bed undefiled: but whoremongers and adulterers God will judge.
Numbers 31:18 But all the women children, that have not known a man by lying with him, keep alive for yourselves.
Hosea 1: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.
Hosea 3:1 Then said the LORD unto me, Go yet, love a woman beloved of her friend, yet an adulteress, according to the love of the LORD toward the children of Israel, who look to other gods, and love flagons of wine.
First of all, the inference is that Moses' action in Number 31 was supported by God which is nowhere stated. Actually Moses by giving the commandment directly disobeyed God's original command not to make a covenant with the Midianites or have relationships with their descendants. (Exodus 23:32, 34:11-17; Deuteronomy 7:2-4, 20:16-18) For more on why this was necessary to stop the horrid Canaanite practice of cannibalistic child sacrifice, see Destruction of Canaanites.
Actually Moses' disobedience was so great that God shortly after this punished Moses by not letting him enter the Promised Land. (Deuteronomy 32:51) Moses similarly disobeyed God by allowing Israelites to divorce their wives, which as Jesus pointed out was contrary to what God intended. (Mark 10:4-12) Jesus if asked about this would likely have said the same thing, that this was a case of Moses disobeying God's commandments. Moses had a history of disobeying God as far back as the burning bush, when God repeatedly told Moses to go to Pharaoh, and Moses first complained that he was a nobody, then complained Pharaoh wouldn't listen, argued he couldn't speak well, and finally just told God to go bother someone else. (Exodus 3:11-4:14)
As for the Hosea passages, the Scofield Study Bible III has addressed this very well in its note for Hosea 1:2:
|“|| 1:2 take to yourself an adulterous wife. God did not command Hosea to take an adulterous wife but permitted him to carry out his desire to marry Gomer, warning him that she would be unfaithful, and using the prophet's tragic experience as a basis for portraying God's relation to Israel during a time of unfaithfulness. Hosea's marriage is no less historical because his children were given symbolic names as a message to Israel (vv. 4,6,9). Compare Isa. 8:18.
-The Scofield Study Bible III, Oxford University Press
For an alternative view, Edward Ridenour of the Christian Post argues that Gomer wasn't originally an adulteress when Hosea married her, and points to Hosea 2:7 as evidence that Hosea was Gomer's first husband. As an interesting side note, the story of Hosea has inspired Christian books such as Francine Rivers' novel, "Redeeming Love."