Why is slavery permitted in Islam?
In a Nutshell:
The term "slavery" is potentially misleading - captives of war is a more accurate term to describe the phenomenon Islam permitted with "indentured servitude" emerging. The taking of captives in war was widespread during the prophet's era.
Slavery as the Europeans practiced it, enslaving free people for no crime, treating them as objects, racialising the process, are all categorically condemned by Islam. Islam put in place the ethics relating to the treatment of captives and servants including how they could exit such servitude through work, payment or other means. It required they be treated on the basis of brotherhood, each having rights and duties, with judicial structures maintaining oversight.