Since Islam is a perfect religion, why had Islam accepted the issue of slavery and had not abolished it?
To understand the real issues about slavery in Islam, it should be noted that the most important and most common method for slavery is that one may become captive in the war between Muslims and non-Muslims. Some other ways return eventually to the mentioned way.
Regarding one who is capturing by the Muslims in war, one of these four ways can be followed:
1. Kill the captive.
2. Release the captive.
3. To put in jail the captive.
4. Capture the captive into slavery.
The first and second way is not certainly approved by wise men. Although the third way is possible nowadays, but according to the existing condition at the time of legislation, it should be said this way also cannot be applied; because the governments at that time were very weaker and smaller than the present governments concerning to the facilities and financial power; because of the large number of wars and captives, it was not possible to hold the captives in prisons and provided them housing and clothing and food as well as those assigned to guard them, due to its huge and backbreaking expenses.
So the only possible way for the government was that to offer the captives as slaves to their citizens who may use their services and also provided life facilities for captives and, in fact, with the participation of citizens, the problem of keeping captives was solved, because the mere keeping of the captives has not been actually welcomed by people without any mutual service from the captives.
In addition, this method at that time was a common and normal practice among all nations and if non-Muslims caught captives from the Muslims, they acted the same with the captives; the principle of reciprocation was an accepted principle among the wise men during the war.
Another thing to consider is that a good law is not necessarily an ideal law, but the good law is a law that first: it has enforcement capabilities, and second: if it is not ideal, but it can lead the society towards the ideal and desired situation of the legislator.
For example, it is obvious that the ideal situation for legislator is that there is no jail and prisoner in the community, but if a legislator rules to remove the prisons in the current situation of society, of course, this law will be denounced and blamed by wise men and they will warn the legislator that if you want to remove the prisons, you may legislate a law, which prevent any crime and felony to provide the elimination of prisons automatically.
In the early Islamic period, the slaves considered from the main economic assets of the community and if Islam would abolish slavery outright, it met a lot of opposition and resistance and this law failed in practice. To better understand, we can compare it with housing and property situation at the present time; if the government wants to announce that people can no longer buy and sell houses and ownership of houses is no longer applicable, this law would be doomed to failure due to the resistance of the majority of people; because the most capital of people will be lost according to this law and a lot of harm and losses will come to them.
According to the aforementioned issues, although Islam did not oppose slavery even it has been approved by Islam, but in practice Islam legislate some rules and regulations beside it that the issue of slavery disappeared over time and abolished automatically without any opposition. For example, the atonement of a lot of sins is the releasing of slaves. Or it is announced that selling the female slave (bondwoman), who has delivered a child from his owner, is impermissible and it also stipulated that she will be released after the death of her owner from the inheritance share of her offspring. In addition to the moral commands which encouraged people to release slaves and considered great reward for it, and a lot of binding rules and regulations applied for the rights of slaves.
In this way, first: Islam solved the problem of keeping captives, second: led captives to be familiar with the rituals of Islam among the Muslim families, Third: Islam did not create sensitivity and resistance against this law and fourth: Islam caused the elimination of slavery over time and reaching its ideal society where slavery did not exist