الجواب حامدا و مصلیا
In the name of Allah, the Most Beneficent and the Most Merciful
Hazrat Yusuf did not unite in matrimony with her merely for carnal desire or by being a prey of a feminine trick, rather, when she renounced her Kufr and Shirk and turned towards Allah after making repentance and Towba, Prophet Yousuf was then informed through Wahi (divine revelation) about marrying her subsequently he united with her in matrimony as is explained clearly in the following narrations of commentary.
Thafseer Jalalain – page no 194 Hashiya – page no 194
Allah knows best.