Ex 21:
Ellicott explained:20 When a man strikes his slave, male or female, with a rod and the slave dies under his hand, he shall be avenged.
Mosaic law provided a better treatment of slaves than other codes at the time. Other nations allowed their masters to kill their slaves.The homicide hitherto considered has been that of freemen; but the Mosaic Law was not content to stop at this point. Unlike most other codes, it proceeded to forbid the homicide of slaves. Hitherto, throughout the East, and also in many parts of the West, slaves had been regarded as so absolutely their master’s property that he was entitled to do as he pleased with them. Now, for the first time—so far as we know—was the life of the slave protected. The exact extent of the protection is uncertain. According to the Talmud, the master who killed his slave was put to death; according to some modern Jews, as Kalisch, he had merely to pay a fine. In any case, the killing was an offence of which the law took cognisance.
From our modern sense of justice, that was unfair treatment. We need to understand these laws within their historical and cultural context.21 But if the slave survives a day or two, he is not to be avenged, for the slave is his money.
From our modern point of view, these laws were unjustified. From the Israelites' point of view, their laws offered better treatment of slaves compared to other peoples' laws.26 When a man strikes the eye of his slave, male or female, and destroys it, he shall let the slave go free because of his eye. 27 If he knocks out the tooth of his slave, male or female, he shall let the slave go free because of his tooth.