Leviticus 25:50-54
50 He and his buyer are to count the time from the year he sold himself up to the Year of Jubilee. The price for his release is to be based on the rate paid to a hired man for that number of years.
51 If many years remain, he must pay for his redemption a larger share of the price paid for him.
52 If only a few years remain until the Year of Jubilee, he is to compute that and pay for his redemption accordingly.
53 He is to be treated as a man hired from year to year; you must see to it that his owner does not rule over him ruthlessly.
54 “‘Even if he is not redeemed in any of these ways, he and his children are to be released in the Year of Jubilee,