Marthad ibn AbuMarthad al-Ghanawi used to take prisoners (of war) from Mecca (to Medina). At Mecca there was a prostitute called Inaq who had illicit relations with him. (Marthad said:) I came to the Prophet ﷺ and said to him: May I marry Inaq, Messenger of Allah? The narrator said: He kept silence towards me. Then the verse was revealed:"....and the adulteress none shall marry save and adulterer or an idolater." He called me and recited this (verse) to me, and said: Do not marry her.
جِئْتُ إِلَى النَّبِيِّ ﷺ فَقُلْتُ يَا رَسُولَ اللَّهِ أَنْكِحُ عَنَاقَ قَالَ فَسَكَتَ عَنِّي فَنَزَلَتْ { وَالزَّانِيَةُ لاَ يَنْكِحُهَا إِلاَّ زَانٍ أَوْ مُشْرِكٌ } فَدَعَانِي فَقَرَأَهَا عَلَىَّ وَقَالَ لاَ تَنْكِحْهَا