Are you familiar with what happened in the South when a people built on farming and agriculture had slavery taken away with no in-between? It was chaos. The South almost collapsed.

Abolishing slavery would have been ideal, yes. But when you have societies that depend on something, sometimes the best way to stop it is to take baby steps toward it. In this case, restrictions and laws to ensure the slaves are treated well until the culture gets to the point where they no longer depend on them.

&gt;Any sex with a slave is rape.

Are you taking about what's written in the text, or modern understanding?

&gt;There are punishments delineated by whether or not the slave dies from the beating.

This is the same with free Israelites. Punishments are very specific in the Tanakh, and get even more absurdly specific in the Talmud (which Jewish people believe you have to read in order to understand what's laid out in the Tanakh. Citing "Exodus 21" isn't enough.).