Islamic views on slavery represent a complex and multifaceted body of Islamic thought, with various Islamic groups or thinkers espousing views on the matter which have been radically different throughout history. Slavery was a mainstay of life in pre-Islamic Arabia and surrounding lands. The Quran and the hadith (sayings of Muhammad) address slavery extensively, assuming its existence as part of society but viewing it as an exceptional condition and restricting its scope. Early Islamic dogma forbade enslavement of dhimmis, the free members of Islamic society, including non-Muslims and set out to regulate and improve the conditions of human bondage. Islamic law regarded as legal slaves only those non-Muslims who were imprisoned or bought beyond the borders of Islamic rule, or the sons and daughters of slaves already in captivity. In later classical Islamic law, the topic of slavery is covered at great length.
Slavery in Islamic law is not based on race or ethnicity. However, while there was no legal distinction between white European and black African slaves, in some Muslim societies they were employed in different roles. Slaves in Islam were mostly assigned to the service sector, including as concubines, cooks, and porters. There were also those who were trained militarily, converted to Islam, and manumitted to serve as soldiers; this was the case with the Mamluks, who later managed to seize power by overthrowing their Muslim masters, the Ayyubids. In some cases, the harsh treatment of slaves also led to notable uprisings, such as the Zanj Rebellion. Bernard Lewis opines that in later times, the domestic slaves, although subjected to appalling privations from the time of their capture until their final destination, seemed to be treated reasonably well once they were placed in a family and to some extent accepted as members of the household.
The Muslim slave trade was most active in west Asia, eastern Europe and sub-Saharan Africa. Muslim traders exported as many as 17 million slaves to the coast of the Indian Ocean, the Middle East, and North Africa.