It's also important to distinguish between the type of slavery discussed here and chattel slavery as it was practiced in the US or other places in the past five hundred years. These rules were primarily regarding an individual selling themselves into servitude for a period not to exceed six years. Unable to provide for themselves, they would become slaves, exchanging their work for provision of food and shelter, and would go free without further payment in the seventh year. If they considered living under the protection and provision of their boss preferable to trying to make it on their own, they could declare themselves a slave for life by piercing their ear as described in Deuteronomy 15. But verse 16 expressly prohibits stealing a person to sell into slavery, or owning a person who has been sold in this way.
At least if the person were a man and a Hebrew.
Women, who were sold as concubines, and foreigners, who were captured during war, didn't have these rights. To our modern minds, we find it hard to stomach this treatment, but in the context of this period in history, the commands in this chapter provided for improved treatment. For example, they required the man to provide for his concubine - even if he took another wife - without diminishing her provisions and released her without penalty if he failed to provide.
There are also some important foundations for law, such as taking responsibility for actions that hurt others even when they were not intentional. Ignoring the risk of an animal that has injured people in the past and paying for damage done by your animal are examples.
Even as we bristle at the notion that God didn't simply declare all slavery to be an abomination, we need to be mindful that there are more human beings held in slavery today than ever before in history. It is estimated that over 400,000 Americans are being trafficked today. Another 15,000 or more foreign nationals are being held as slaves in America.
There are many organizations that work to educate the public to recognize the signs of trafficking and to help women and children, who comprise 80% of all slaves, to escape and find safety.