The Old Testament does permit slavery (servitude) but only under special circumstances and with restrictions. It says an Israelite (Hebrew) father could sell his daughter as a slave (Exodus 21:7, Nehemiah 5:5), the child of a widow could be sold as one to pay her father's debt (2Kings 4:1), and both men and women could sell themselves into slavery (Leviticus 25:39, 47, Deuteronomy 15:12 - 17).
Slavery within Israel was meant to be far more humane than the practices adopted by the rest of the world. Scripture commanded that those in such bondage receive good treatment (Leviticus 25:43 - 46). They were allowed to have a wife, children, and even their own money (Exodus 21).
Slaves, in the Old Testament, could receive gifts when freed (Deuteronomy 15:13). Males, after circumcision (if they were not already), were allowed to partake in the Passover and other religious ceremonies in worshipping God.
Those who were subjected to any form of servitude could receive their freedom in a number of ways. They could be bought or redeemed out of servitude (Leviticus 25:48 - 55). If they worked six years, in the seventh year of service they were set free (Exodus 21).
In the Jubilee year, all those in servitude were set free (Leviticus 25:40). Servants who were abused by their master and maimed (e.g. lost a tooth or eye) were also released (Exodus 21). Those under the burden of slavery could also be set free directly by God (Jeremiah 34:8 - 10).
The New Testament
In the New Testament, Jesus never deals directly with the issue of slavery one way or the other in his teachings. It should also be noted that the Greek word doulos (Strong's Concordance #G1401), translated "servant," can mean "slave," however, or vice versa.
Although the Apostle Paul discusses slavery, he neither offers a clear condemnation of the institution nor justifies its practice. He does encourage Philemon (Philemon 10 - 18), a slaveholder, to take back a runaway who had converted to Christianity. There are texts in which servants are told to obey, not revolt against, their masters (Colossians 3:22, Ephesians 5:5 - 9, 1Timothy 6:1, Titus 2:9). Ultimately, Paul does not think the status of servitude matters spiritually (Colossians 3:11).
One could use the Golden Rule of loving one's neighbor as themselves as enough of a reason to be against slavery. Hence, if you loved someone equal to yourself, and you would not want servitude, then you would not put him or her in bondage to you.
It must be admitted, however, that there is no explicit condemnation of owning slaves in the New Testament. As a side note, the Essenes were against the ownership of other humans and asserted it was repugnant to nature.
It is only in fairly recent times that the Islamic world officially abolished slavery even as the West has done. The Islamic (Arab) world received (through East Africa) a number of bond slaves generally estimated to number as many as those sent across the Atlantic during the well-known West African trade. Saudi Arabia only officially abolished the practice around 1962 or so, ironically about the same time Malcom X visited Mecca!
During the Sudan's long civil war, Muslims in the north sold their opponents into servitude to the Christians or animists of the south. As a matter of history, those who believed in the God of the Bible have been in the lead in abolishing slavery, while the Muslim world has generally lagged behind on the issue.