What is the stance of Islam on slavery?
Slavery was an established and applied system among the nations before Islam and it was free of any restrictions. Islam's struggle against slavery aimed at changing the perspective and mentality of the whole society in such a way that slaves, after their emancipation, would become full and effective members of society without the need to resort to demonstrations, strikes, civil disobedience, or even ethnic revolutions. The objective of Islam was to get rid of this abominable system as soon as possible through peaceful methods.
Islam did not allow the ruler to treat his subjects as slaves. It granted the ruler and the ruled rights and duties within the limits of freedom and justice that are guaranteed for all. Thus, the slaves' emancipation took place gradually through expiations, voluntary charities, and hastening to do goodness by freeing slaves to get closer to the Lord of the worlds.
Moreover, a woman who gave birth to her master's child would not be sold; rather, she would automatically get her freedom after her master's death. Unlike all the previous traditions, Islam legislated that a bondmaid's child should be attributed to his father and, thus, become free. It also legislated that a slave could buy himself from his master by paying a sum of money or working for a certain period of time.
Allah Almighty said:
{...If any of your slaves wishes to enter the contract of emancipation, make this contract with them, if you find goodness in them...} [244] Surat an-Nūr: 33.
In the battles that Prophet Muhammad (may Allah's peace and blessings be upon him) fought in defense of the religion, life, and property, he used to command his Companions to treat the captives with kindness. The captives had the choice to win their freedom back either through paying a sum of money or through teaching children reading and writing. Moreover, captivity in Islam did not deprive a child of his mother or a man of his brother.
Islam also ordered Muslims to show mercy to the fighters who surrender.
Allah Almighty said:
{If any of the polytheists asks you for protection, give it to him, so that he may hear the Word of Allah, then escort him to his place of safety; that is because they are a people who do not know.} [245] Surat at-Tawbah: 6.
Furthermore, Islam stipulated the possibility of helping slaves free themselves by paying from the Muslims' money or from the state treasury, as the Prophet (may Allah's peace and blessings be upon him), along with his Companions, offered ransom from the public treasury to free slaves.
Allah Almighty said:
{Your Lord has ordained that you worship none but Him, and show kindness to parents. If one or both of them reach old age in your care, do not say to them a word of annoyance nor scold them, rather speak to them noble words, and lower to them the wing of humility out of mercy, and say, “My Lord, have mercy upon them as they raised me when I was small.”} [246] Surat al-Isrā’: 23-24.
{We have enjoined upon man kindness to his parents. His mother bore him in hardship and gave birth to him in hardship, and his bearing and weaning take thirty months, until when he reaches full maturity and reaches forty years, he says, “My Lord, inspire me to be grateful to Your favors which You blessed me and my parents with, and to do righteous deeds that will make You pleased; and make my offspring righteous. Indeed, I repent to you, and I am one of the Muslims [submitting to You].”} [247] Surat al-Ahqāf: 15.
{Give relatives their due, and the needy and the stranded travelers, and do not spend wastefully.} [248] Surat al-Isrā’: 26.
The Messenger of Allah (may Allah's peace and blessings be upon him) said: "By Allah, he is not a believer! By Allah, he is not a believer! By Allah, he is not a believer." It was said: "Who is that, O Messenger of Allah?" He said: "One whose neighbor does not feel safe from his evil." [249] Agreed upon.
The Messenger of Allah (may Allah's peace and blessings be upon him) also said: "The neighbor is the most entitled to the right of preemption, so let him wait for him even if he is absent, if they share the same road." [250] "Musnad al-Imām Ahmad".
The Messenger of Allah (may Allah's peace and blessings be upon him) said as well: "O Abu Dharr, if you cook broth, increase the amount of water in it and give some to your neighbors." [251] Narrated by Muslim.
Moreover, the Messenger of Allah (may Allah's peace and blessings be upon him) said: "Whoever has a piece of land and wants to sell it, let him offer it to his neighbor." [252] Sahīh (authentic) in "Sunan Ibn Mājah".