21:2-4 The ancients practiced slavery widely in the Near East. These laws protected slaves in Israel better than the laws of other nations protected slaves in those countries.
"In Israel slaves had far better rights than elsewhere in the ancient Near East."360
We should read verse 4 with the following condition added at the end of the verse: unless he pays a ransom for them. This was possible as is clear from the instructions regarding the redemption of people that follow.
Why did God permit slavery at all? Slavery as a social institution becomes evil when others disregard the human rights of slaves. God protected the rights of slaves in Israel. (Likewise Paul did not urge Philemon to set his slave Onesimus free but to treat him as a brother.) As amended by the Torah, slavery became indentured servant living in Israel for all practical purposes, similar to household servanthood in Victorian England. Mosaic law provided that male slaves in Israel should normally serve as slaves no more than a few years and then go free. In other nations, slaves often remained enslaved for life.
"We can then conclude that Exodus 21:2-4 owes nothing to non-Biblical law. Rather it is a statement of belief about the true nature of Israelite society: it should be made up of free men. Economic necessities may lead an Israelite to renounce his true heritage, but his destiny is not in the end to be subject to purely financial considerations. Exodus 21:2 is no ordinary humanitarian provision, but expresses Israel's fundamental understanding of its true identity. No matter how far reality failed to match the ideal, that ideal must be reaffirmed in successive legislation. So, in gradually worsening economic conditions both Deuteronomy (15:1-18) and the Holiness Code (Lev. 25:39-43) reiterate it. It is the male Israelite's right to release (Exod. 21:2-4) which explains why the laws of slavery (21:2-11) head that legislation which sought to come to terms with Israel's new found statehood with all its consequent economic problems under the united monarchy."361
Presumably female as well as male slaves could experience redemption from their condition at any time.
21:5-6 The Code of Hammurabi decreed that the master of a rebellious slave could cut off the ear of that slave. So the ear (v. 6) evidently marked the status of a slave in the ancient Near East (cf. Ps. 40:6).