I was hoping to research and write a full article on this, and inshallah will do so in the future. For now please follow this link. There is in fact not much to add to it:
A brief summery to the response to the issue of slavery in general needs again to go back to some basic conceptual issues. I discussed some of these in my article on "Brutal Islamic Punishments" below. It seem to me that the Sharia is in its essence “utilitarian”, or it aims for the greatest good for the greatest number of people. This utilitarianism is of course biased towards the faithful, obedient servants of God, that is the people of Islam. The purpose of creation, and the deen and Sharia of Islam and ethic of the Muslim ummah is to make obedience to Allah supreme. It is in the context of this imperative that we need to understand this and other issues.
1. Slavery was the norm in all societies at the time of the Prophet.
2. Economies ran and depended on the institution of slavery. It would have put the Islamic nation at an untenable disadvantage to eliminate slavery all together.
3. The teachings of the Prophet rather emphasised changing the nature of the slave/master relationship. The slave came to be treated as a member of the household and was given certain rights, although was still not entirely equal to free persons.
4. Slaves are either captives of war distributed at the discretion of the Amir, or those born into slavery.
5. Slavery is not compulsory or ordered or an intrinsic part of Islam. If the status quo does not allow taking slaves or there is a benefit in abandoning the use of slaves the Muslim nation is free to do that at the command of the Ameer, or leader, or to reintroduce that if it needed.
6. There are many encouragements within Islamic teachings to free slaves.
7. Sexual relations were permitted between a man and his female slaves.
It should be mentioned that sex in general is not considered a bad or evil thing in Islam. It is a lawful pleasure for both men and women. It is however restricted by certain parameters. One of the restrictions is that it must be within the confines of marriage, with the exception above. This was the norm at the time, and restricting this practice would perhaps been practically impossible. The onus on the master was still to treat his slaves with kindness and care. If the slave girl became pregnant she had to be freed, and the Prophet (saws) encouraged freeing and marrying of slave girls.