Praise be to Allaah.
There is no report in the Holy Qur'aan or the Sunnah of the Prophet (blessings and peace of Allah be upon him) to prove or disprove that Yoosuf (peace be upon him) married the wife of al-Azeez, whose name was said by some to be Raeel and by others to be Zulaykha; al-Haafiz Ibn Katheer suggested that Zulaykha was her title.
There is a report about Yoosuf (peace be upon him) marrying Raeel that was narrated from a well-known imam of seerah and history, Muhammad ibn Ishaaq (may Allah have mercy on him) who said:
With regard to Yoosuf saying to the King, Set me over the store‑houses of the land; I will indeed guard them with full knowledge [Yoosuf 12:55], the king said: I will do that. So he appointed him instead of Itfeer and dismissed Itfeer from his post. Allah says: Thus did We give full authority to Yoosuf (Joseph) in the land, to take possession therein, when or where he likesâ€¦ [Yoosuf 12:56].
He said: It was mentioned to me - and Allah knows best - that Itfeer died during those nights and that the King al-Rayyaan ibn al-Waleed gave Itfeer's wife, Raeel, to Yoosuf in marriage, and when she entered upon him he said: Is this not better than what you wanted? And they claimed that she said: O Siddeeq, do not blame me, for I was a woman who was, as you see, beautiful and enjoying a life of luxury, and my husband could not have intimate relations with women, and you are as Allah made you, very handsome, and I could not help myself.
They claimed that he found her a virgin and he had intercourse with her and she bore him two sons: Afra'eem ibn Yoosuf and Maysha ibn Yoosuf. The son of Afra'eem was Noon, the father of Yoosha ibn Noon, and Rahmah the wife of Ayyoob (peace be upon him). End quote.
Narrated by Ibn Abi Haatim in al-Tafseer, 7/2161; al-Tabari in Jaami al-Bayaan, 16/151.
A similar report was narrated from Zayd ibn Aslam, the great Taabii, and from Wahb ibn Munabbih, from the Israa'eeliyyaat (reports from Jewish sources).
That was also narrated by al-Suyooti in al-Durr al-Manthoor, 4/553
Ibn al-Qayyim (may Allah have mercy on him) said:
Chapter 27: One who gives up his beloved to avoid a haraam relationship and then was enabled to be with his beloved in a halaal way, or Allah compensated him with some one better, as Yoosuf al-Siddeeq avoided the wife of al-Azeez for the sake of Allah, and chose prison over immoral action, and Allah compensated him by giving him full authority in the land to take possession therein when or where he wanted, and the woman came to him humbly asking for a halaal relationship, so he married her and when he entered upon her he said: This is better than what you wanted.
Think about how Allah, may He be glorified and exalted, rewarded him for the hardship of prison and gave him full authority in the land to take possession therein when or where he wanted, and subdued for him the wife of al-Azeez, and she and the other women attested to his innocence. This is what Allah ordained for His slaves in the past and at present until the Day of Resurrection.
End quote from Rawdat al-Muhibbeen, p. 445
This does not mean that this story is definitively true; rather it seems that it was taken from the People of the Book, and we have been commanded not to believe them and not to disbelieve them either. The Prophet (blessings and peace of Allah be upon him) said: Do not believe the People of the Book and do not disbelieve them. Say: We believe in that which has been revealed to us and revealed to you, our God and your God is One, and we submit to Him. Narrated by al-Bukhaari, 4485; classed as saheeh by al-Albaani in Silsilat al-Ahaadeeth al-Saheehah, 422
And Allah knows best.