Sunan an-Nasa'i, Hadith 3959 ⓘ
It was narrated from Anas, that the Messenger of Allah had a female slave with whom he had intercourse, but 'Aishah and Hafsah would not leave him alone until he said that she was forbidden for him. Then Allah, the Mighty and Sublime, revealed: "O Prophet! Why do you forbid (for yourself) that which Allah has allowed to you.' until the end of the Verse.
أَخْبَرَنِي إِبْرَاهِيمُ بْنُ يُونُسَ بْنِ مُحَمَّدٍ، حَرَمِيٌّ - هُوَ لَقَبُهُ - قَالَ حَدَّثَنَا أَبِي قَالَ، حَدَّثَنَا حَمَّادُ بْنُ سَلَمَةَ، عَنْ ثَابِتٍ، عَنْ أَنَسٍ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم كَانَتْ لَهُ أَمَةٌ يَطَؤُهَا فَلَمْ تَزَلْ بِهِ عَائِشَةُ وَحَفْصَةُ حَتَّى حَرَّمَهَا عَلَى نَفْسِهِ فَأَنْزَلَ اللَّهُ عَزَّ وَجَلَّ { يَا أَيُّهَا النَّبِيُّ لِمَ تُحَرِّمُ مَا أَحَلَّ اللَّهُ لَكَ } إِلَى آخِرِ الآيَةِ .
also referenced under: Book 36, Hadith 21 (In-Book) & Volume 4, Book 36, Hadith 3411 (DarusSalam)