Leviticus 25:41-51

41 At that time he and his children will no longer be obligated to you, and they will return to their clans and go back to the land originally allotted to their ancestors.
42 The people of Israel are my servants, whom I brought out of the land of Egypt, so they must never be sold as slaves.
43 Show your fear of God by not treating them harshly.
44 “However, you may purchase male and female slaves from among the nations around you.
45 You may also purchase the children of temporary residents who live among you, including those who have been born in your land. You may treat them as your property,
46 passing them on to your children as a permanent inheritance. You may treat them as slaves, but you must never treat your fellow Israelites this way.
47 “Suppose a foreigner or temporary resident becomes rich while living among you. If any of your fellow Israelites fall into poverty and are forced to sell themselves to such a foreigner or to a member of his family,
48 they still retain the right to be bought back, even after they have been purchased. They may be bought back by a brother,
49 an uncle, or a cousin. In fact, anyone from the extended family may buy them back. They may also redeem themselves if they have prospered.
50 They will negotiate the price of their freedom with the person who bought them. The price will be based on the number of years from the time they were sold until the next Year of Jubilee—whatever it would cost to hire a worker for that period of time.
51 If many years still remain until the jubilee, they will repay the proper proportion of what they received when they sold themselves.
Holy Bible. New Living Translation copyright© 1996, 2004, 2007, 2013 by Tyndale House Foundation. Used by permission of Tyndale House Publishers Inc., Carol Stream, Illinois 60188. All rights reserved.