Leviticus 25:40-41
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,
25:41 but then he may go free, he and his children with him, and may return to his family and to the property of his ancestors.