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.
أَخْبَرَنِي إِبْرَاهِيمُ بْنُ يُونُسَ بْنِ مُحَمَّدٍ، حَرَمِيٌّ - هُوَ لَقَبُهُ - قَالَ حَدَّثَنَا أَبِي قَالَ، حَدَّثَنَا حَمَّادُ بْنُ سَلَمَةَ، عَنْ ثَابِتٍ، عَنْ أَنَسٍ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم كَانَتْ لَهُ أَمَةٌ يَطَؤُهَا فَلَمْ تَزَلْ بِهِ عَائِشَةُ وَحَفْصَةُ حَتَّى حَرَّمَهَا عَلَى نَفْسِهِ فَأَنْزَلَ اللَّهُ عَزَّ وَجَلَّ { يَا أَيُّهَا النَّبِيُّ لِمَ تُحَرِّمُ مَا أَحَلَّ اللَّهُ لَكَ } إِلَى آخِرِ الآيَةِ .
كتاب عشرة النس 36 The Book of Kind Treatment of Women (4) Chapter: Jealousy (4) باب الْغَيْرَةِ
Sunan an-Nasa'i 3959
1 Answer
Having sex with a slave that one owns is permissible in Islam as they are "those your right hand possesses" as mentioned in the verses 23:6 and 4:3. The relation is not much different from a normal wife, as the following conditions similar to marriage apply:
Sex may only be had with a slave whom one owns, it is not permitted to have relations with a slave who is owned by someone else.
Ownership must be complete, sex is not permissible with a slave who has multiple owners.
Sex is not permitted with a slave who is married to someone else.
A period of time known as Istibra must be observed before having sexual relations. That means passage of menstrual periods to ensure that the womb is empty, the purpose of which is to remove any doubts of being pregnant with the child of another person. A similar waiting period should be observed before selling the slave or giving her in marriage.
Her living expenses are due on her owner
If she gives birth to a child then that child is legitimate and the owner is responsible for it.
If she becomes pregnant then she can not be sold and becomes free after the death of her owner.
Having sex with a such a slave was also permissible for the Prophet Muhammad ﷺ as the Quran explicitly states:
يا أيها النبي إنا أحللنا لك ... وما ملكت يمينك مما أفاء الله عليك
O Prophet, indeed We have made lawful to ... those your right hand possesses from what Allah has returned to you [of captives]
Mariyah al-Qibtiyyah was a slave among the gifts sent to the Prophet by al-Muqawqis the ruler of Egypt. She became the Prophet's Umm Walad by giving birth to his son Ibrahim. The hadith you have quoted is likely referring to her.
Several of the Sahaba also had relations with their slaves and had children from them. Among the children of the sahaba from slaves are Ali bin al-Husain ibn Ali, Qasim ibn Muhammad ibn Abi Bakr, Salim bin Abdullah ibn Umar.