Asking from a non-muslim's viewpoint, If Islam preaches equality, then why does it permit slavery?
Even though our Imams and Prophets has accepted slave system, but Islam had a plan to free slaves gradually. What people don't normally pay attention to is that if a wrong system has entered a society, removing it needs time and scheduling. If you do something without considering all aspects, it'll have opposite results. It's like something infected with a dangerous virus, or an addicted person who cannot just stop using drugs all of a sudden.
Now if Islam had ordered to free slaves, some of them could got perished when they were an important group in the society. Or a large group of people could became jobless without a place to live in.
Islam consider freeing slaves an "Ibadat", all Prophets and Imam tended to free slaves so simply to give other people a lesson on how it's done.
The Prophet Muhammad (PBUH) said:
This is a quite popular Hadith among Shi'as.
There are many verses in the Quran discussing slavery, and throughout the life of Prophet Mohammad (pbuh) slavery was fully accepted. There is no evidence to suggest that slavery is in anyway or form banned in Islam.
Based on the above Hadith, Slavery is an element of an Islamic Society.
Some oppose slavery because they are brainwashed to think slavery is bad, and evil, this belief couldn't be further from the truth.
Slavery is the most efficient replacement for the prison system.
In the prison system, the criminal or enemy combatant's expenses are paid by the victim and other innocent people, while the prisoner is not expected to do any work, this is the case in most Western societies.
In slavery, the criminal, or enemy combatant's expenses are paid by his/her owner, while the slave is expected to work for the owner.
The latter is more fair and just, while the former is insulting no matter how you look at it, yet we still have Muslim and none Muslim arguing against slavery, simply because slaves were treated horribly by some societies.
Islam has laws governing slavery, if slavery wasn't part of Islam, there would be no laws on it.
Islam permits slavery for those who come to fight against Muslims and Islam. Slavery is a kind of blessing for those who are slaves.
Islam does not permit slavery to muslims. In fact one of the requirements of being a muslim is to not enslave one another (3:64).
But Islam does not force other adherers to other ideology to conform to Islam's belief system (15:3,23:54,43:84,52:45,70:42) even at the expense of death to uphold their beliefs(6:112) at one extreme.
So if there is a citizen (a mushrik/polytheist or kaafir/rejecter of the concept of Prime Creator) amongst the nation and he has a slave who is a muslim, the nation has no right to take away from the citizen his muslim slave, because it's part of the belief of this citizen to own a slave, and the nation has no right to take it away from him. Otherwise there would be bloodshed amongst muslim and non-muslim to fight for an ideological point of view, which Islam does not want. This is what is meant in the verse 24:32.
that is amongst your male and female citizens that are being enslaved. If we take it that islam allows slavery amongst the muslims, it would be contradicting verse 3:64.
so in this verse Allah SWT is talking to us as a nation (with muslim and non-muslim citizens) and not as a group of muslims.