All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah and that Muhammad, sallallaahu ʻalayhi wa sallam, is His slave and Messenger.
First of all, you should know that Juwayriyah bint Al-Haarith belonged to Banu Al-Mustaliq; she was a polytheist and not from the People of the Book. The Prophet, sallallaahu ʻalayhi wa sallam, freed her, then she embraced Islam, and then he married her. Ibn Al-Jawzi wrote:
“She said, ‘O Messenger of Allaah! I am Juwayriyah bint Al-Haarith, the chief of his people. You know well what had happened to me (that she was captured). I fell in the share of Thaabit ibn Qays, and I agreed with him to ransom myself with nine ouqiyyahs (an ouqiyyah is a measure of weight [of silver]). So help me to free myself.' The Messenger of Allaah, sallallaahu ʻalayhi wa sallam, replied, ‘Do you want what is better than that?’ She said, 'What is it?' The Prophet, sallallaahu ʻalayhi wa sallam, said, ‘I will pay your ransom on your behalf and marry you.' She said, 'Yes, O Messenger of Allaah.’ The Prophet, sallallaahu ʻalayhi wa sallam, then said, 'I have done that.' Then the news of the marriage came to the people, and they started saying, 'Will the Prophet's in-laws be held as captives?!' So they freed all the captives that were with them of the tribe of Banu Al-Mustaliq, and the number of those freed reached one hundred households because of the Prophet's marriage to Juwayriyah. ('Aa'ishah said) I do not know of any other woman who brought about more blessings upon her people." [Sifat As-Safwah] Notice how she addressed him saying, “O Messenger of Allaah,” when she was not yet ransomed or married to the Messenger of Allaah .
As for Safiyyah bint Huyayy she was the daughter of Huyayy ibn Akhtab, the chief of the Jewish tribe Banu An-Nadheer. So she was a Jew; however, the Prophet, sallallaahu ʻalayhi wa sallam, did not marry her except after her conversion to Islam. Ibn Saʻd narrated on the authority of ʻAtaa ibn Yasaar that he said:
“When Safiyyah arrived from Khaybar (i.e. to Madeenah), she stayed in a house belonging to Haarithah ibn An-Nuʻmaan. The women of the Ansaar heard of this and came to see her beauty. ʻAa'ishah also came, wearing her face veil. When she left, the Messenger of Allaah, sallallaahu ʻalayhi wa sallam, followed her. Then he asked her, 'What did you see?' She replied, 'I saw a Jewish woman!' He, sallallaahu ʻalayhi wa sallam, then said to her, 'Do not say that; she has embraced Islam and has become a good Muslim.' This was cited by Ibn Hajar in his book Al-Isaabah.” [At-Tabaqaat]
It should be noted that some scholars held that the Prophet, sallallaahu ʻalayhi wa sallam, was exclusively prohibited from marrying from among the women of the People of the Book (Christians and Jews) although it is deemed lawful for all other Muslim men. The book At-Taaj wal-Ikleel, on the Maaliki Fiqh, reads, “It was deemed prohibited for the Prophet, sallallaahu ʻalayhi wa sallam, to eat garlic and other foods which cause bad breath ... and marrying from the People of the Book...”
Needless to say, it is lawful for Muslim men to marry (chaste) Christian and Jewish women; scholars advised that one of the wisdoms behind the permissibility of such marriages is softening their hearts perchance they would consider embracing Islam. The Kuwaiti Encyclopedia of Fiqh reads, “It is deemed lawful for the Muslim man to marry (chaste) women of the People of the Book perchance they would embrace Islam given the fact that they believe in the books of the Prophets and Messengers of Allaah in general...”
Allaah knows best.