You need to read the whole chapter to understand the position of slavery within Israel, not just one verse taken out of context.
This verse simply means that a slave is not to be badly treated. Hitting a slave with a rod as a disciplinary measure is one thing, but to kill him with the rod is another matter. The first is allowed the second is not. It was meant to keep masters from killing their slaves, which was not their right. Disciplining them was their right.
Haydock’s Catholic Bible Commentary says:
Ver. 21. Money, which purchased the slave. Hence, as he will be punished in some degree, and it is not absolutely certain that the slave died of his wounds, his master shall not be put to death. “They are slaves, (says Seneca, ep. 47,) but they are our fellow-slaves.” We have one common origin, and one master over us all, Job xxxi. 13. (Haydock) — Many nations tolerated the murder of slaves by their masters. But this was contrary to reason and humanity, (Calmet) and condemned by many of the Roman laws. (Christen.)
Let’s compare it to today’s employer/employee. A employer has certain rights and so does the employee. Employees are money to an employer because without them he could not have his company/put out his product/do business. If the worker doesn’t do his job his employer has certain rights. He can demote him, fire him, or reduce his pay, but he can’t kill him. Does that help?