"If a man has two wives, one loved and the other unloved, and they have borne him children, both the loved and the unloved, and if the firstborn son is of her who is unloved,
Deuteronomy 21:15
Surrounding context
21:14 And it shall be, if you have no delight in her, then you shall set her free, but you certainly shall not sell her for money; you shall not treat her brutally, because you have humbled her.
21:15 "If a man has two wives, one loved and the other unloved, and they have borne him children, both the loved and the unloved, and if the firstborn son is of her who is unloved,
21:16 then it shall be, on the day he bequeaths his possessions to his sons, that he must not bestow firstborn status on the son of the loved wife in preference to the son of the unloved, the true firstborn.