Leviticus 25:49
or his uncle or the son of his uncle or a near relative may redeem him.
Israelite Slave of a Foreigner If an alien or temporary resident becomes prosperous and one of your brothers becomes so poor that he has to sell himself to a stranger living with you or a member of the stranger’s family,
You may pass them down to your children as inherited possessions and bind them for life. However, concerning your fellow Israelites, you must not govern them harshly.
You may also buy from among the aliens who live with you and from their families, born in your land, and they may be your property.
Foreign Slaves As for the male and female slaves, it is from the nations around you that you are to buy them.
For they are my servants whom I brought out of the land of Egypt, and they are not to be sold as slaves.
He shall then leave you, he and his sons with him, and return to his own family and the property of his ancestors.
but let him stay with you as a hired servant and a foreigner until the year of Jubilee.