Islam does not prohibit slavery but retains it for two reasons. The first reason is war (whether it is a civil war or a foreign war in which the captive is either killed or enslaved) provided that the war is not between Muslims against each other - it is not acceptable to enslave the violators, or the offenders, if they are Muslims. Only non-Muslim captives may be enslaved or killed. The second reason is the sexual propagation of slaves which would generate more slaves for their owner
Context: Slavery is officially against the civil law in all nations including Muslim countries. However, nothing in Islamic law prohibits slavery. Those who would have Sharia law often forget that slavery would then be legal PROVIDED the slaves are not Muslims. The legal prohibitions against slavery are not enforced in a number of countries including Saudi Arabia. Even officially slavery was legal in that country until the early 1960s. Apologists for Islamic slavery point out that it is very humane and any individual who wants to be free can be just by becoming a Muslim. He is then no longer able to be held in slavery. They justify the practice as it encourages non believers to become Muslims, the most important goal.
Abdul-Latif Mushtahari, Director of Homiletics and Guidance, Al-Azhar University, Cairo, You Ask and Islam Answers
Sourced by: Eigen's Political and Historical Quotations