First of all, having sexual relations with female slaves was, in some eras, the practice of prophets and companions. That practice was necessitated for some specific reasons and the ruling cannot be of a general application.
Furthermore, it should be noted that when Islam was reveled to Prophet Muhammad (peace and blessings be upon him), slavery was a worldwide common social phenomenon; it was much older than Islam. Slavery was deeply rooted in every society to the extent that it was impossible to imagine a civilized society without slaves.
In spite of this social fact, Islam was the first religion to recognize slavery as a social illness that needed to be addressed. Since slavery was deeply rooted in the society, Islam did not abolish it at once. Rather, Islam treated slavery in the same manner it treated other social illnesses. Islam followed the same methodology of gradual elimination in dealing with this social disease as it did with other social illnesses, for example: the prohibition of alcohol in three steps.
Concerning having slave women, we would like to let you know that it happens to be a practice necessitated by the condition in which early Muslims found themselves vis-a-vis non-Muslims, as both parties engaged in wars. Slave women or milk al-yameen are referred to in the Qur’an as “Those whom your right hand possess” or “ma malakataymanukum”; they are those taken as captives during conquests and subsequently became slaves, or those who were descendants of slaves.
Thus, it was a war custom in the past to take men and women as captives and then turn them into slaves. Islam did not initiate it, rather, it was something in practice long ago before the advent of Islam. And when Islam came, it tried to eradicate this practice, bit by bit. So it first restricted it to the reciprocal practice of war, in the sense that Muslims took war captives just as the enemies did with Muslims.
But as it aimed at putting an end to such issue, Islam laid down rules which would eventually lead to eradicating the practice. So it allowed Muslims to have intercourse with slave women taken as captives of just and legitimate wars. In so doing, the woman would automatically become free if she got pregnant. What’s more, her child would also become free.
Not only that, Islam also ordered a Muslim to treat the slave woman in every respect as if she were his wife. She should be well fed, clothed and given due protection. In the family environment, she had the opportunity to learn about Islam and was free to accept it or reject it. She also had the opportunity to earn her freedom for she could be ransomed.
In the light of the above-mentioned facts, it’s clear that some people misunderstand the wisdom behind the permissibility of having female slaves and think that it is meant to unleash men’s desires and give them more enjoyment. Never! That is not the point! It is, rather, means of freeing slaves; and this is clarified above in the fact that if a master got a female slave pregnant, then he could neither sell her nor give her away as a present. And if he died, she would not be considered part of his property. She’d receive her freedom and her baby would also be free.
But, we have to stress that this case should not be confused with that of female servants or maids, for they are free and not slaves. Therefore, it is forbidden to engage in sexual relations with them except through an Islamic marriage.
Slavery has been abolished by international conventions, and goes in line with aims and objectives of Islam, as it has called for centuries ago.
As for marrying slaves, it is something permissible under two conditions: first, if one is unable to pay the dowry of a free woman. Second, if there is fear of committing adultery if one doesn’t get married. This is clarified by the following verse:[And whose is not able to afford to marry free, believing women, let them marry from the believing maids whom your right hands possess. This is for him among you who fearethto commit sin. But to have patience would be better for you.](An-Nisaa’4: 25)
In conclusion, Allah has forbidden certain types of behavior and permitted other kinds of behavior as a safeguard to the individual and to the society. Allah has forbidden fornication and adultery. However, in the case of captives whom your right hands posses, it’s something necessitated by the special circumstances which were created when the Muslims were at war.”