How the Muslims are permitted to acquire slavesLet me first start with a statement from the scholars...
"Slaves (men and women) may be taken in the wars that take place between Muslims and kaafirs, not in wars that are fought amongst the Muslims at times of tribulation.
Islam limited the sources of slaves which existed before the mission of the Prophet (peace and blessings of Allaah be upon him) to just one source, namely slavery resulting from capturing prisoners from among the kuffaar,
including women and children. Shaykh al-Shanqeeti (may Allaah have mercy on him) said: The reason why a person may be taken as a slave is his being a kaafir and waging war against Allaah and His Messenger. If Allaah enables the Muslims who are striving and sacrificing their lives and their wealth and all that Allaah has given them to make the word of Allaah supreme over the kaafirs, then He allows them to enslave the kuffaar when they capture them, unless the ruler chooses to free them or to ransom them, if that serves the interests of the Muslims.
Adwa’ al-Bayaan, 3/387"
http://www.islamqa.com/en/ref/26067/Now lets examine the types of "jihad" or fighting between Muslims and non Muslims...
"Jihaad against the kuffaar with weapons is of two types: jihad talab (offensive jihad) and jihad daf’ (defensive jihad).
Jihad talab means attacking the kuffaar in their own lands until they become Muslim or pay the jizyah with willing submission and feel themselves subdued. The Prophet (peace and blessings of Allaah be upon him) said: “I have been commanded to fight the people until they bear witness that there is no god but Allaah and that Muhammad is the Messenger of Allaah, and establish regular prayer, and pay zakaah. If they do that, then they have protected their blood and their wealth from me, except in cases decreed by Islamic law, and their reckoning with be with Allaah.” Narrated by al-Bukhaari, 25; Muslim, 20."
http://www.islamqa.com/en/ref/26125/Now defensive jihad (jihad daf') is pretty self explainatory. But we need to look closer at offensive jihad (jihad talab).
As the scholars have explained using the authentic hadith jihbad talab is to attack the non Muslims in order to spread the message of Islam. How this works is non Muslims are invited to Islam and if they refuse they are to be attacked. It does not matter whether they were hostile towards the Muslims or not. Males women and children of these non Muslims are permissable to be taken and sold as slaves.
Proof that Muhammad and his companions acquired slaves in this mannerNarrated 'Abdul 'Aziz: Anas said, 'When Allah's Apostle invaded Khaibar, we offered the Fajr prayer there yearly in the morning) when it was still dark. The Prophet rode and Abu Talha rode too and I was riding behind Abu Talha. The Prophet passed through the lane of Khaibar quickly and my knee was touching the thigh of the Prophet . He uncovered his thigh and I saw the whiteness of the thigh of the Prophet. When he entered the town, he said, 'Allahu Akbar! Khaibar is ruined. Whenever we approach near a (hostile) nation (to fight) then evil will be the morning of those who have been warned.' He repeated this thrice. The people came out for their jobs and some of them said, 'Muhammad (has come).' (Some of our companions added, "With his army.") We conquered Khaibar, took the captives, and the Booty was collected. Dihya came and said, 'O Allah's Prophet! Give me a slave girl from the captives.' The Prophet said, 'Go and take any slave girl.' He took Safiya bint Huyai. A man came to the Prophet and said, 'O Allah's Apostles! You gave Safiya bint Huyai to Dihya and she is the chief mistress of the tribes of Quraiza and An-Nadir and she befits none but you.' So the Prophet said, 'Bring him along with her.' So Dihya came with her and when the Prophet saw her, he said to Dihya, 'Take any slave girl other than her from the captives.' Anas added: The Prophet then manumitted her and married her." Thabit asked Anas, "O Abu Hamza! What did the Prophet pay her (as Mahr)?" He said, "Her self was her Mahr for he manumitted her and then married her." Anas added, "While on the way, Um Sulaim dressed her for marriage (ceremony) and at night she sent her as a bride to the Prophet . So the Prophet was a bridegroom and he said, 'Whoever has anything (food) should bring it.' He spread out a leather sheet (for the food) and some brought dates and others cooking butter. (I think he (Anas) mentioned As-SawTq). So they prepared a dish of Hais (a kind of meal). And that was Walrma (the marriage banquet) of Allah's Apostle ."
In this hadith it shows that the women of defeated peoples may be taken as slaves. These women were not slaves they were members of the jewish tribe in question. the bolded text shows that even the "chief mistress" of the tribe was available to be taken as a slave.
It was narrated that Ruwayfi’ ibn Thaabit al-Ansaari said: I heard the Messenger of Allaah (peace and blessings of Allaah be upon him) say on the day of Hunayn: “It is not permissible for any man who believes in Allaah and the Last Day to irrigate the crop of another else – meaning to have intercourse with a woman who is pregnant. And it is not permissible for a man who believes in Allaah and the Last Day to have intercourse with a captured woman until he has established that she is not pregnant. And it is not permissible for a man who believes in Allaah and the Last Day to sell any booty until it has been shared out.”
Narrated by Abu Dawood, 2158; classed as hasan by Shaykh al-Albaani in Saheeh Abi Dawood, 1890.
This hadith further proves that it is permissible for Muslims to take captive women as salves and have intercourse with them.
Slaves that were owned by MuhammadThe following is an account by the scholars of the slaves that were owned by Muhammad. Many of them were black (nubian). He owned over 25 slaves.
Ibn al-Qayyim said:
Zayd ibn Haarithah ibn Shuraaheel, the beloved of the Messenger of Allaah (peace and blessings of Allaah be upon him). He freed him and arranged his marriage to his freed slave woman Umm Ayman, and she bore him Usaamah. His other slaves include Aslam, Abu Raafi’, Thawbaan, Abu Kabshah Sulaym, Shaqraan (whose name was Saalih), Rabaah (who was Nubian), Yassaar (who was also Nubian and was killed by the ‘Arniyeen); Mid’am and Kirkirah (another Nubian) – these two were killed at Khaybar. They also included Anjashah al-Haadi and Safeenah ibn Farookh, whose real name was Mihraan, but the Messenger of Allaah (peace and blessings of Allaah be upon him) called him Safeenah (= “ship”) because they used to make him carry their luggage when they traveled, so he said, “You are a ship (anta safeenah).” Abu Haatim said that the Messenger of Allaah (peace and blessings of Allaah be upon him) freed him; someone else said that Umm Salamah freed him. The Prophet’s slaves also included Anasah, whose nickname was Abu Mashrah; Aflah; ‘Ubayd; Tahmaan – also known as Keesaan; Dhakwaan; Mihraan; Marwaan – although it was said that this was another name of Tahmaan, and Allaah knows best; Hunayn; Sandar; Fudaalah (who was Yemeni); Maaboor (who was a eunuch); Waaqid; Abu Waaqid; Qassaam; Abu ‘Usayb and Abu Muwayhabah.
His female slaves included: Salma (Umm Raafi’); Maymoonah bint Sa’d; Khadrah; Radwa; Razeenah; Umm Dameerah; Maymoonah bint Abi ‘Usayb; Maariyah and Rayhaanah.
Zaad al-Ma’aad, 1/114-116