islam came to regain dignity for humanity regardless of their race and colour. islam made all human beings equal and made the principle of taqwa (piety) the only basis by which people are considered superior to others. the prophet (pbuh) destroyed after the conquest of mecca all colour and race differences and totally finished off racial discrimination when he asked bilal ibn rabah to ascend to the top of kaaba to chant the word of monotheism. even before this incident, the prophet (pbuh) made as brothers his uncle hamza and his slave zayd.
hajjat al-wadaa, principle of equality
in hajjat al-wadaa (the farewell pilgrimage), the prophet (pbuh) declared the principle of equality when he said:“all mankind is from adam and adam is from dust. an arab has no superiority over a non-arab. a black person has no superiority over a red person nor does a red person have any superiority over a black person, except by piety.”and from here came the call for freedom and finishing off slavery.
the origin in islam is that all people are born free and not slaves and that is because they all belong to one father and were all born as free. islam came to recognize this right at a time when people were enslaved and shown all sorts of humiliation and slavery.
islam and manumission of slaves
the pro-islam humanity lived in communities and civilizations that were marked by tyrannical citizenship systems based on the tribe you come from and flagrant class differences, which divide human communities into several classes, topped by the free men who enjoy all rights of sovereignty and power while slaves are crushed. they have no right to freedom or descent life.
islam came to recommend believers to manumit slaves and set them free. islam called this favor or amnesty. islam also considers this a praiseworthy act and urges believers to set free slaves, even if one had to purchase them first with his own money. islam also made expiation for certain sins committed by the master, such as beating the slave or doing him injustice, is to set them free. it also recommended setting free slaves. it also made expiation for certain sins such as manslaughter, zihar (divorcing your wife by declaring her your mother), perjury and breaking fasting in ramadan by setting slaves free. islam also ordered muslims to help slaves when they want mukataba (want to pay for their freedom). islam also made manumission of slavery as one of the ways to dispense of zakat (alms). a female slave was set free upon her master’s death, if she gave a birth to a boy, whose father was the master.
islam’s plan to solve slavery problem
islam’s wise plan to solve the problem of slavery- this human problem- can be summed up in three points; first, it prevented all the situations in which enslaving occurs (except war), second, islam suggested many ways to manumit slaves, and third, it protected slaves’ rights after being freed.
the islamic legislation urged the emerging muslim community to manumit slaves and set them free, promising masters great reward in the hereafter. abu huririanarrated that the prophet (pbuh) said: “if somebody manumits a slave, allah will save from the fire every part of his body for freeing the corresponding parts of the slave's body, even his private parts will be saved from the fire) because of freeing the slave's private parts."
the prophet (pbuh) also recommended setting free slave-girls and marrying them. abu musa al-asha’ri narrated that the prophet said:"he who has a slave-girl and educates and treats her nicely and then manumits and marries her, will get a double reward."the prophet (pbuh) also freed safiyya bint huyayy ibn akhtab and made her emancipation her dowry to marry her.
the recommendations of the prophet (pbuh) to deal well with slaves were keys to rehabilitate the society for accepting their emancipation and manumission. the prophet (pbuh) called for dealing well with them even through expressions and words. he said: “one should not say, my slave (abdi), or my girl-slave (amati), you are slaves of allah and all your wives are slave-girls of allah. but one should say, my lad (fatai), my lass (fatati), and 'my boy (ghulami)."
islam also made it obligatory on masters to feed their slaves and clothe them the way they feed and clothe and not to burden them with unbearable load of work. jabir ibn abduallh narrated that the prophet (pbuh) used to recommend muslims to treat slaves well and say: "slaves are your brothers. allah has put them to serve you. so, feed them with your food; clothe them as you clothe yourselves and burden them not with what they can not do….”islam has given slaves many other rights that made them a human being with dignity that no one can transgress.
in a later more important stage, islam made atonement for beating and abusing slaves is to set them free so that the society can move to realistic emancipation stage. it was narrated that abdullah ibn umar has once beaten a slave-boy of his. then, he called him and asked him: “does it hurt you? the boy replied: “no”. ibn umar said: “go you are free” and then picked some sand from the earth and said: “i have no reward in what i have done. i heard allah’s messenger (pbuh) says: “whoever beats or slaps his slave-boy on the face should manumit him as an atonement.”
islam also made pronouncing the word of manumission one that should go effective. the prophet (pbuh) said:“there are three matters that must always be taken seriously, whether they are said in earnest or jest. they are: marriage, divorce and manumission of slaves.”
islam has also made emancipation of slaves one of the ways to atone for sins and mistakes to make it possible to free the biggest possible number of slaves. committing sins never ends and all human beings commit mistakes. the prophet (pbuh) says in this regard: “if a muslim man emancipates a muslim man, allah, the exalted, will make every bone of his protection for every bone of his emancipator from hell; and if a muslim woman emancipates a muslim woman, allah will make every bone of hers protection for every bone of her emancipator from hell on the day of resurrection.”
islam also enabled slaves to restore their freedom through mukataba (the slave purchases his freedom for money) and urged masters to help slaves do this because freedom is the origin and slavery is an exception. the prophet (pbuh) was an example in this regard. he paid the mukataba for juwairiyah bint al-harith and married her. when muslims learnt that the prophet (pbuh) married juwairiyah, they set free all the slaves they had because of her. one-hundred families were set free from bani al-mustaliq.
moreover, islam has legislated emancipation of slaves and considered this as one of the dispensations of zakat. god almighty says: “alms are for the poor and the needy, and those employed to administer the (funds); for those whose hearts have been (recently) reconciled (to truth); for those in bondage… “[repentance: 60]
it was also reported that the prophet (pbuh) set free 63 people, while aiysha (may allah be pleased with her) set free 69, abu bakr set free many slaves, al-abbas 70 slaves, uthman 20 slaves, hakim ibn hizam 100 slaves, abdullah ibn umar 1000 slaves and abdul rahman ibn auf 30,000 slaves. 
this islamic policy has managed in downsizing the trade of slaves until it was abolished. in late islamic periods, islam elevated slaves and put them on top of political and military offices. one good example of this are the memluks, who ruled a big section of the islamic nation for about 300 years. this is undoubtedly unrivalled in the history of the world.
ahmad (23536), shu’aib al-arnaut said: isnad correct, al-tabarni: al-mu’agam al-kabir (14444), al-baihaqi: shu’ab al-iman (4921), al-albani said: sahih, look: al-silsilah al-sahiha (2700)
al-bukhari: kafarat al-iman book, chapter of god almighty’s saying: “or give a slave his freedom” [the table: 89], and which slaves are better freed (6337), muslim: itq book, chapter of grace of itq (1509)
al-bukhari: nikah book (marriage), chapter about taking sarari (concubines) (4795)
al-bukhari: al-magazi (conquests), chapter about khaybar conquest (3965), muslim: nikah book (marriage), chapter about virtue who sets slave-girl and marries it (1365)
al-bukhari from abu huraira: itq book, chapter about hatred to insult slaves and saying: my slave, my slave-girl (2414), muslim: book about alfaz min al-adab and others, chapter about hukm itlaq lafz al-abd and al-amah (2249)
muslim: al-iman book, chapter about feeding slaves the way master feeds … (1661), ahmad (21521), al-bukhari: al-adab al-mufrad 1/76
muslim: al-iman book, chapter about company of slaves, atonement for whoever slaps a slave (1657), abu dawoud (5168), ahmad (5051)
al-harith musnad (503), narrated by al-baihaqi from umar ibn al-khattab 7/341
muslim: itq book, chapter about virtue of itq (1509), al-termizi from abu umamah (1547), ibn majah (2522)
al-salihi al-shami: subul al-huda wal irshad 11/210, al-suhaili: al-rawd al-anf 4/18, ibn kathir: al-sirah al-nabawiyah 3/303
that was counted by al-kitani in his book: al-taratib al-idariah, p. 94, 95