Hosea is described by Rabbi Yochanan in Pesachim 87a as the greatest of the four major prophets. At G-d's command (Hosea 1:2), he married a prostitute, Gomer, and fathered children, although there was some doubt as to whether they were all his. His wife continues her harlotry even after they are married, but Hosea refuses to divorce her. This is turned into a beautiful metaphor for G-d's refusal to divorce Israel, although it, too, had strayed. I understand it to be black-letter halacha that a husband must at least divorce his wife if she admitting to having sex with another man. (Of course, in Temple times, she and her lovers would have been subject to a criminal trial if two witnesses could testify they saw her commit adultery.)
My question is: how could Hosea's prophecy be accepted if he refused to follow one commandment? Also, couldn't his prophecy that G-d told him to take Gomer back (Hosea 3:1; Pesachim 87b) be considered self-serving? Rabbi Barry Fruendel suggested to me that Hosea got a "pass" because he was a prophet. What is the basis for that? I assume he had to be recognized as a prophet before he violated the law, right?