Some think that when Muslims conquered territory, slaves were often taken or that slavery is allowed in Islam.
When the Quran was revealed, slavery was in wide practice throughout the Arab World, thus, it would have been impractical and detrimental to place an immediate ban on the slave trade, forcing all slaves into unemployment/poverty. The Quran uses a better psychological approach to win people’s hearts in the struggle against slavery and all forms of discrimination by placing a strong emphasis on human dignity and equality and encouraging the freeing of slaves:
And We guided him to both paths? He should choose the better path. Do you know which is the better path? The freeing of slaves. Or the feeding on a day of great hardship. [90:10-14]
Piety is not to turn your faces towards the east and the west, but pious is one who believes in Allah and the Last Day, and the angels, and the Book, and the prophets, and who gives money out of love to the relatives, and the orphans, and the needy, and the wayfarer, and those who ask, and to free the slaves… [2:177]
The Quran lists the penalty for various misdemeanors as freeing of slaves, see 4:92, 5:89, 58:3. It also implies distribution of community/collective charities would contribute towards freeing of slaves:
Indeed, the charities are for the poor, and the needy, and those who work to collect them, and those whose hearts have been united, and to free the slaves, and those in debt, and in the cause of Allah, and the wayfarer. A duty from Allah, and Allah is Knowledgeable, Wise. [9:60]
The only method mentioned in The Quran for gaining captives (more correctly termed ‘prisoners of war’, not slaves) is during warfare, after which they must be released or ransomed. Keeping them is not an option:
Therefore, if you encounter those who have rejected, then strike the necks; until you bind them, then secure the cords. You may then either set them free or ransom them, until the war ends. That, and if Allah had willed, He alone could have beaten them, but He thus tests you by one another. As for those who get killed in the cause of Allah, He will never let their deeds be put to waste. [47:4]
Interestingly, in the above verse, it implies a preference for taking captives rather than killing the enemy in warfare.
As can clearly be seen, taking all of the above verses of The Quran into account, it would lead to a gradual reduction in slave numbers and eventually abolish slavery.