Read up on your history. Slaves back then arent the same as they are now. Back in the Old Testament, slaves were treated like human beings. They also weren't born into slavery like the ones most people think of when the term slave comes to mind.If god changed from Old Testament to New Testament what makes you think he hasn't changed after? God also said slavery and beating of slaves was ok. Does that mean I can go buy myself a slave? No. That is called human trafficking and is a serious criminal charge
Back then, a slave was someone who was work for food/shelter/stuff and willing to bind themselves with an owner.
They bound themselves to work, in accordance to rules, and if you broke those rules, then it was ok to beat your slaves accordingly.
Slavery was more of servantry back then, and not like working all day and being abused. The bible also states people whom abuse their slaves shall be put to death, lemme find that verse