Deuteronomy 21:15

Inheritance Rights of the Firstborn

15If a man has two wives a  the one loved and the other unloved, and both the loved and the unloved have borne him children, and if the firstborn son belongs to the unloved
Or hated; also verses 16, 17
Copyright information for ESV