Abraham had 8 sons, Ishmael from Hagar, Isaac from Sarah, and 6 sons: Zimran, Jokshan, Medan, Midian, Ishbak, and Shuah, all from Keturah, his 2nd wife after Sarah died. There is a blessing for all of Abraham’s children but the special everlasting covenant will go to Isaac only because this promise was for Sarah’s son with Abraham and she only had one son.
Genesis 17:1-22 is God’s full promise to Abraham reiterated and fully spoken in detail. In previous chapters, he hints at the rewards and makes a promise, but doesn’t give details about Abraham’s side of the covenant. In verses 1-6, he says to Abraham to “walk before me, and be thou perfect”, meaning stop sinning and live righteously on purpose. This statement, plus what he says later about Ishmael getting a blessing but not being the promised seed of the everlasting covenant (that would be Isaac), implies that what he did with Hagar was a sin because he and Sarah doubted God’s abilities and did their own thing.
In addition, God changes Abram’s name (meaning great father) to Abraham (father of many nations). In verses 7-8, God gives his side of the covenant, which promises an everlasting covenant, and gives the land of Canaan to all the nations that descend from him. Then in verses 9-14 God tells Abraham his side, which is about teaching his descendants to only worship one God and to dedicate themselves to him through male circumcision. Then in verses 15-16 God talks about Sarai’s role in the promised covenant and God changes her name to Sarah (meaning princess), and says she will be blessed as the mother of nations (Jacob/Israel & Esau/Edom).
In verse 17, Abraham laughs at the thought of Sarah and him having a natural child at such an old age (99 for Abraham and 89 for Sarah). Then in verse 18, he wishes that Ishmael could be in God’s presence. This indicates that God had rejected the circumstances of Ishmael’s birth.
God replies in verse 19 that Sarah will have a child and HE will receive the EVERLASTING COVENANT, and his name will be Isaac which means laughter.
In verses, 20-21 God confirms that Ishmael is rejected as the promised seed that will inherit the everlasting covenant, but promises to give him and the 12 nations that will later come from him a blessing for being Abraham’s descendant. Verse 21 reiterates verse 19, saying that the everlasting covenant is only for Isaac because he is Sarah’s son.
This is reiterated again in Genesis 21:8-13 when Sarah wants to kick Ishmael and Hagar out for bullying her son Isaac at the weaning ceremony. Abraham is troubled but God reminds him that, despite the everlasting covenant with Sarah’s son, there is still a blessing for Ishmael. Later in verses 14-21, God tells this to Hagar and Ishmael as they are wandering in the desert and shows them an oasis and takes care of them into the future when Ishmael marries and has the 12 tribes of Ishmael. Long story short Isaac is the promised seed, not Ishmael despite the fact he was the firstborn because the covenant is with Sarah Isaac’s mother.