Islam caters for rights of every creature. It urges a Muslim to show good and kind treatment to anyone under his/her control; he should neither maltreat him or her nor should he subject him/her to any form of exploitation. Islam totally objects and fights all forms of slavery. The focus of Islam in all its teachings and rites was to eradicate this prevailing practice. Now, slavery has been abolished by international conventions, and this goes in line with aims and objectives of Islam.

When Islam was revealed 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 malakat aymanukum”; they are those taken as captives during conquests and subsequently became 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, and the nature of the question posed by people, 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.

Having stated the above, it becomes clear that Islam gave slaves certain rights in order to protect them against mistreatment, let alone it put certain legislations in order to abolish this well-established phenomenon (slavery) gradually.

Finally, we’d like to add that the institution of slavery, by the grace of Allah, no longer exists in the world. Therefore, the question regarding keeping slaves or slave girls does not arise anymore. We should not pay much attention to such issues which are of no avail or practical use nowadays. Islam encourages its followers to concentrate on issues of real and practical relevance.