O you who have believed, when the believing women come to you as emigrants, examine [i.e., test] them. Allāh is most knowing as to their faith. And if you know them to be believers, then do not return them to the disbelievers; they are not lawful [wives] for them, nor are they lawful [husbands] for them. But give them [i.e., the disbelievers] what they have spent.1 And there is no blame upon you if you marry them when you have given them their due compensation [i.e., mahr]. And hold not to marriage bonds with disbelieving women, but ask for what you have spent and let them [i.e., the disbelievers] ask for what they have spent.2 That is the judgement of Allāh; He judges between you. And Allāh is Knowing and Wise.
Translation: Saheeh International (English)
1 For marriage, i.e., compensate their loss.
2 When a disbelieving wife chose to join the disbelievers, a Muslim husband could demand in return the equivalent of her mahr. Likewise, the disbelievers had a similar right when a believing woman joined the Muslims. This and the following verses were revealed subsequent to the Treaty of al-Ḥudaybiyyah.
O you who have faith in Allah, and who act on what He has ordained for you, when believing women come to you as emigrants from the land of disbelief to the land of Islam, then test them with respect to the sincerity of their faith. Allah knows best about their faith - nothing of what their hearts contain is hidden from Him. If you are sure of their being believers after such a test that makes their sincerity apparent to you, then do not send them back to their disbelieving husbands. It is not lawful for believing women to be married to disbelievers and it is not lawful for disbelievers to marry believing women. Give their husbands the dowry that they paid. There is no sin on you, O believers, if you marry them after their waiting period is over if you give them their dowry. The person whose wife is a disbeliever or who turned away from Islam, then he should not retain her, because their marriage has terminated by her disbelief. Ask the disbelievers for the dowry you paid to your renegade wives and let them ask for the dowry of their wives who accepted Islam. That - which has been mentioned about your and their returning the dowry - is Allah’s judgment. He (may He be glorified) passes judgment amongst you as He wills. Allah knows the states and actions of His servants. Nothing of that is hidden from Him. He is Wise in what He ordains for His servants.