Slavery has been rife throughout all of ancient history. Most, if not all, ancient civilizations practiced this institution and it is described (and defended) in early writings of the Sumerians, Babylonians, and Egyptians. It was also practiced by early societies in central America and Africa. (See Bernard Lewis's work Race and Slavery in the Middle East1 for a detailed chapter of the origins and practices of slavery.)
The Qur'an prescribes a humanitarian approach to slavery -- free men could not be enslaved, and those faithful to foreign religions could live as protected persons, dhimmis, under Muslim rule (as long as they maintained payment of taxes called Kharaj and Jizya). However, the spread of the Islamic Empire resulted in a much harsher interpretation of the law. For example, if a dhimmis was unable to pay the taxes they could be enslaved, and people from outside the borders of the Islamic Empire were considered an acceptable source of slaves.
Although the law required owners to treat slaves well and provide medical treatment, a slave had no right to be heard in court (testimony was forbidden by slaves), had no right to property, could marry only with permission of their owner, and was considered to be a chattel, that is the (moveable) property, of the slave owner. Conversion to Islam did not automatically give a slave freedom nor did it confer freedom to their children. Whilst highly educated slaves and those in the military did win their freedom, those used for basic duties rarely achieved freedom. In addition, the recorded mortality rate was high -- this was still significant even as late as the nineteenth century and was remarked upon by western travelers in North Africa and Egypt.
Slaves were obtained through conquest, tribute from vassal states (in the first such treaty, Nubia was required to provide hundreds of male and female slaves), offspring (children of slaves were also slaves, but since many slaves were castrated this was not as common as it had been in the Roman empire), and purchase. The latter method provided the majority of slaves, and at the borders of the Islamic Empire vast number of new slaves were castrated ready for sale (Islamic law did not allow mutilation of slaves, so it was done before they crossed the border). The majority of these slaves came from Europe and Africa -- there were always enterprising locals ready to kidnap or capture their fellow countrymen.
Black Africans were transported to the Islamic empire across the Sahara to Morocco and Tunisia from West Africa, from Chad to Libya, along the Nile from East Africa, and up the coast of East Africa to the Persian Gulf. This trade had been well entrenched for over 600 years before Europeans arrived, and had driven the rapid expansion of Islam across North Africa.
By the time of the Ottoman Empire, the majority of slaves were obtained by raiding in Africa. Russian expansion had put an end to the source of "exceptionally beautiful" female and "brave" male slaves from the Caucasians -- the women were highly prised in the harem, the men in the military. The great trade networks across north Africa were as much to do with the safe transportation of slaves as other goods. An analysis of prices at various slave markets shows that eunuchs fetched higher prices than other males, encouraging the castration of slaves before export.
Documentation suggests that slaves throughout Islamic world were mainly used for menial domestic and commercial purposes. Eunuchs were especially prised for bodyguards and confidential servants; women as concubines and menials. A Muslim slave owner was entitled by law to use slaves for sexual pleasure.
As primary source material becomes available to Western scholars, the bias towards urban slaves is being questioned. Records also show that thousands of slaves were used in gangs for agriculture and mining. Large landowners and rulers used thousands of such slaves, usually in dire conditions: "of the Saharan salt mines it is said that no slave lived there for more than five years.1"
1. Bernard Lewis Race and Slavery in the Middle East: An Historical Enquiry, Chapter 1 -- Slavery, Oxford Univ Press 1994.
This text revised from an article first published on About.com on 2 April 2001.