Leviticus 25:39-55
39 “If your brother among you becomes destitute and sells himself to you, you must not force him to do slave labor. 40 Let him stay with you as a hired hand or temporary resident; he may work for you until the Year of Jubilee. 41 Then he and his children are to be released from you, and he may return to his clan and his ancestral property. 42 They are not to be sold as slaves, because they are My slaves that I brought out of the land of Egypt. 43 You are not to rule over them harshly but fear your God. 44 Your male and female slaves are to be from the nations around you; you may purchase male and female slaves. 45 You may also purchase them from the foreigners staying with you, or from their families living among you—those born in your land. These may become your property. 46 You may leave them to your sons after you to inherit as property; you can make them slaves for life. But concerning your brothers, the Israelites, you must not rule over one another harshly.
47 “If a foreigner or temporary resident living among you prospers, but your brother living near him becomes destitute and sells himself to the foreigner living among you, or to a member of the foreigner’s clan, 48 he has the right of redemption after he has been sold. One of his brothers may redeem him. 49 His uncle or cousin may redeem him, or any of his close relatives from his clan may redeem him. If he prospers, he may redeem himself. 50 The one who purchased him is to calculate the time from the year he sold himself to him until the Year of Jubilee. The price of his sale will be determined by the number of years. It will be set for him like the daily wages of a hired hand. 51 If many years are still left, he must pay his redemption price in proportion to them based on his purchase price. 52 If only a few years remain until the Year of Jubilee, he will calculate and pay the price of his redemption in proportion to his remaining years. 53 He will stay with him like a man hired year by year. A foreign owner is not to rule over him harshly in your sight. 54 If he is not redeemed in any of these ways, he and his children are to be released at the Year of Jubilee. 55 For the Israelites are My slaves. They are My slaves that I brought out of the land of Egypt; I am Yahweh your God.
Deuteronomy 15:12-18
12 “If your fellow Hebrew, a man or woman, is sold to you and serves you six years, you must set him free in the seventh year. 13 When you set him free, do not send him away empty-handed. 14 Give generously to him from your flock, your threshing floor, and your winepress. You are to give him whatever the Lord your God has blessed you with. 15 Remember that you were a slave in the land of Egypt and the Lord your God redeemed you; that is why I am giving you this command today. 16 But if your slave says to you, ‘I don’t want to leave you,’ because he loves you and your family, and is well off with you, 17 take an awl and pierce through his ear into the door, and he will become your slave for life. Also treat your female slave the same way. 18 Do not regard it as a hardship when you set him free, because he worked for you six years—worth twice the wages of a hired hand. Then the Lord your God will bless you in everything you do.