But it OK to keep slaves!
Judging a 20th century BC society from a 21st century AD perspective is usually not very wise. There was no social assistance system back then. No food banks. If people were destitute they either sold themselves into slavery or died in debtor's prison. That's how it was done in the surrounding nations.The thing that set Israel apart was, like the verse above, slaves were to be treated as members of one's own family. And what's more, they were to be released after seven years regardless of whether the debt was paid. The verse above was actually talking about slaves from other nations who had escaped to Israel.