Leviticus 25:39-40

25:39 “‘If your brother becomes impoverished with regard to you so that he sells himself to you, you must not subject him to slave service. 25:40 He must be with you as a hired worker, as a resident foreigner; he must serve with you until the year of jubilee,

Leviticus 25:48

25:48 after he has sold himself he retains a right of redemption. One of his brothers may redeem him,