A Commentary, Critical, Practical, and Explanatory on the Old and New Testaments, by Robert Jamieson, A.R. Fausset and David Brown  at sacred-texts.com
exo 21:1LAWS FOR MENSERVANTS. (Exo 21:1-6)
judgments--rules for regulating the procedure of judges and magistrates in the decision of cases and the trial of criminals. The government of the Israelites being a theocracy, those public authorities were the servants of the Divine Sovereign, and subject to His direction. Most of these laws here noticed were primitive usages, founded on principles of natural equity, and incorporated, with modifications and improvements, in the Mosaic code.
exo 21:2If thou buy an Hebrew servant--Every Israelite was free-born; but slavery was permitted under certain restrictions. An Hebrew might be made a slave through poverty, debt, or crime; but at the end of six years he was entitled to freedom, and his wife, if she had voluntarily shared his state of bondage, also obtained release. Should he, however, have married a female slave, she and the children, after the husband's liberation, remained the master's property; and if, through attachment to his family, the Hebrew chose to forfeit his privilege and abide as he was, a formal process was gone through in a public court, and a brand of servitude stamped on his ear (Psa 40:6) for life, or at least till the Jubilee (Deu 15:17).
exo 21:7LAWS FOR MAIDSERVANTS. (Exo. 21:7-36)
if a man sell his daughter--Hebrew girls might be redeemed for a reasonable sum. But in the event of her parents or friends being unable to pay the redemption money, her owner was not at liberty to sell her elsewhere. Should she have been betrothed to him or his son, and either change their minds, a maintenance must be provided for her suitable to her condition as his intended wife, or her freedom instantly granted.
exo 21:23eye for eye--The law which authorized retaliation (a principle acted upon by all primitive people) was a civil one. It was given to regulate the procedure of the public magistrate in determining the amount of compensation in every case of injury, but did not encourage feelings of private revenge. The later Jews, however, mistook it for a moral precept, and were corrected by our Lord (Mat 5:38-42).
exo 21:28If an ox gore a man or a woman, that they die--For the purpose of sanctifying human blood, and representing all injuries affecting life in a serious light, an animal that occasioned death was to be killed or suffer punishment proportioned to the degree of damage it had caused. Punishments are still inflicted on this principle in Persia and other countries of the East; and among a rude people greater effect is thus produced in inspiring caution, and making them keep noxious animals under restraint, than a penalty imposed on the owners.
exo 21:30If there be laid on him a sum of money, &c.--Blood fines are common among the Arabs as they were once general throughout the East. This is the only case where a money compensation, instead of capital punishment, was expressly allowed in the Mosaic law.