A slave is a person who is treated as property and forced to work. Thankfully, slavery is illegal today in every single country of the world. Enslaving someone is a crime against humanity in the International Criminal Court.
However, this doesn’t change the fact that legal forms of slavery have existed in many places and times, both ancient and recent. This has been a reoccurring theme in human history we must never forget.
Legally owned slaves and prisoners of war were a daily reality in the climate of tribal warfare when the Qurʾān was revealed.
A huge part of the work of Muḥammad ﷺ was indeed to build peace and establish law and order to the barbarous times he lived in.