Why do rules about restitution for theft follow immediately after rules about slavery in #exodus? Two reasons come to mind.

1) Poverty often leads to theft, and a thief might have to sell himself into slavery to make restitution.
2) Biblical slavery was regulated to act as a social safety net for the very destitute. It's better to become a slave than a thief.