Check out Exodus 21:16
“Whoever steals a man and sells him, and anyone found in possession of him, shall be put to death.
So God doesn't want us to steal slaves or work people against their will, which is generally what slaves were. The word used for slaves in the Bible was very different, it involved allowing them to choose to work or leave, and they were also fed, and given a home. And you also need to remember that the slaves that were not given that choice were people they captured from nations that practiced idolatry, killing babies, etc. So it was either like a prisoner of war thing, or a person that decided to work for them. And I think it is pretty just to force someone who burns babies to work against their will, right? Wouldn't that seem kind of just?