(1) Societies that already have slaves when Islam reaches them
(2) War-captives in a society after a trading of captives has not taken place
In the first instance, the freeing of slaves is rigorously encouraged as an act of charity and expiation of sins. Further, slave-holders are encouraged to make a contract for emancipation with their slaves who ask for it.
In the second instance, the context of war is narrowly defined. In Qur-an 2.190 it is a reaction to being killed. The next sign adds the situation of Muslims being driven out of their homes or lands. This sign also points out the fact that “fitnah” is worse than killing. The word fitnah here is said by some to refer to people being prevented from Islam or forced out of it, so that too may be a context. The first 15 or so verses of chapter 9, as well as 8.58, deal with the killing that takes place when other groups betray their covenants with Muslims. I use the word “killing” here because that is the most direct translation of the word used in the Qur-an, to my limited knowledge. After all, killing is what takes place in war anyways. The greater point is that every time someone known as a Muslim fights or kills is not legal, and it can be very illegal. Incidentally, the word “jihaad”, in any of its grammatical forms, is not used in any of the aforementioned verses. The word jihaad, or its grammatical, is overwhelmingly used in the Qur-an to refer to a Muslims bettering themselves and their implementation and knowledge of Islam. Finally, this has been a very quick and admittedly incomplete survey of what war is in Islam. Among many other things, the Qur-an is a constitutional text that is a foundation of a complete legal code, which it takes true scholars to fully expound.
Moving back to the point of war-captives, in the very limited contexts that war can happen in will necessarily lead to the taking of captives by all sides. The results of this may be the trading of captives, the ransom of captives, the execution of captives (only combatants in Islamic law), or the keeping of captives. The word “captive” is a bit misleading, of course. Everyone who falls under an enemy’s control may not see them as an enemy. A government may be at war with a polity whom some of its constituents may welcome. Whatever the case, when people move from one state to another because of war and stay there, they live in a household where they must be clothed as their keepers dress, eat what their keepers eat, etc. under Islamic law. This is not fortunate or comfortable, or obviously agreeable, but neither are the circumstances that led to it, and considering that, this is the best and fairest way to incorporate them into the society that they are in.
So Qur-an does not contain statements that promote slavery. It only allows the “taking” of “slaves” in the extreme and unusual circumstance of war. And even then, there are several possible fates besides captivity. When this happens, male captives may be assigned to the households of either females or males, and females may be assigned to males or females. In the case of males possessing females, rather than raping them, men are encouraged in at least 2 places to marry them, so as not to commit fornication or adultery (Qur-an 4.3, 4.25). Where those women have previously been married
As for slavery in Muslim-populated lands, slavery was and is a worldwide phenomenon that Muslims have and still do engage in. This was and is wrong, and I remember hearing a narration to the effect that the slave price is cursed. Unfortunately I’m on vacation and do not have any books beside the Qur-an at my disposal. That notwithstanding, I am sure from what I have read that there is no circumstance that justifies the taking of slaves, most certainly not the slave trade.
To clarify that with an example, just as most world economies involve usury, most of those in Muslim-majority countries do as well. That does not mean that Islam promotes usury. In fact it forbids it. The examples of Muslims dealing in slavery is no different.