Short answer
Ishmael. In Genesis 22 God (﷾) tells Abraham to offer "thine only son". Isaac was never Abraham's only son. Ishmael was born fourteen years before him, and Genesis calls Ishmael Abraham's son. Ishmael was still alive when Abraham died, and the two brothers buried him together. So there was not one day in Isaac's life when he was an only son. For fourteen years Abraham had only one son, and that son was Ishmael. The words "only son" fit Ishmael. The name Isaac beside them does not fit. The Qur'an tells the story without naming the son. Only after the story ends does it give Abraham the good news of Isaac. So the Qur'an's order points to Ishmael too.
Full explanation
What Genesis says
Genesis 22 names Isaac as the son to be offered on a mountain in Moriah. Three times in the chapter God (﷾) calls him Abraham's only son. The letter to the Hebrews, in the New Testament, repeats this. It calls Isaac Abraham's only begotten son. Christians read "only" as the one son of the promise, since God (﷾) had said that Abraham's line would be called in Isaac.
“And he said, Take now thy son, thine only son Isaac, whom thou lovest, and get thee into the land of Moriah; and offer him there for a burnt offering upon one of the mountains which I will tell thee of.”
“And he said, Lay not thine hand upon the lad, neither do thou any thing unto him: for now I know that thou fearest God, seeing thou hast not withheld thy son, thine only son from me.”
“And said, By myself have I sworn, saith the Lord, for because thou hast done this thing, and hast not withheld thy son, thine only son:”
“By faith Abraham, when he was tried, offered up Isaac: and he that had received the promises offered up his only begotten son,”
“And God said unto Abraham, Let it not be grievous in thy sight because of the lad, and because of thy bondwoman; in all that Sarah hath said unto thee, hearken unto her voice; for in Isaac shall thy seed be called.”
Isaac was never an only son
Genesis itself gives the dates. Abraham was 86 when Ishmael was born and 100 when Isaac was born, so Ishmael was fourteen years older. Genesis calls Ishmael Abraham's son. One chapter before the sacrifice, Abraham grieves over sending away "his son". Ishmael outlived his father and stood beside Isaac at his burial. On the Bible's own figures, the words "thine only son" can only describe Ishmael, before Isaac was born.
“And Abram was fourscore and six years old, when Hagar bare Ishmael to Abram.”
“And Abraham was an hundred years old, when his son Isaac was born unto him.”
“And Hagar bare Abram a son: and Abram called his son’s name, which Hagar bare, Ishmael.”
“And the thing was very grievous in Abraham’s sight because of his son.”
“And his sons Isaac and Ishmael buried him in the cave of Machpelah, in the field of Ephron the son of Zohar the Hittite, which is before Mamre;”
In Genesis 22 God (﷾) tells Abraham to offer “thine only son”.
Was Isaac ever an only son?
No. Ishmael was born fourteen years before him, when Abraham was 86. Genesis calls Ishmael Abraham's son.
Did Ishmael stop being his son?
No. Genesis never says so. Ishmael outlived Abraham, and the two brothers buried him together.
So when did Abraham have only one son?
For fourteen years, before Isaac was born. That son was Ishmael.
What does the Qur'an say?
It tells the story without naming the son. Only after the story ends does it give Abraham the good news of Isaac.
The words “only son” fit Ishmael. The name Isaac beside them does not fit.
The law of the firstborn
Hagar was given to Abraham as his wife, not only as a servant. The Law of Moses forbids a man with two wives to pass over his firstborn son because the firstborn's mother is the less loved wife. Ishmael was the firstborn. Nowhere does Genesis say Ishmael stopped being Abraham's son. God (﷾) also calls Ishmael Abraham's seed, meaning his offspring. After the sacrifice God (﷾) promises to multiply Abraham's seed as the stars (Genesis 22:17). He had already given Ishmael a blessing of the same kind, by name. He promised to multiply him exceedingly, give him twelve princes and make him a great nation (Genesis 17:20).
“And Sarai Abram’s wife took Hagar her maid the Egyptian, after Abram had dwelt ten years in the land of Canaan, and gave her to her husband Abram to be his wife.”
“If a man have two wives, one beloved, and another hated, and they have born him children, both the beloved and the hated; and if the firstborn son be hers that was hated: Then it shall be, when he maketh his sons to inherit that which he hath, that he may not make the son of the beloved firstborn before the son of the hated, which is indeed the firstborn: But he shall acknowledge the son of the hated for the firstborn, by giving him a double portion of all that he hath: for he is the beginning of his strength; the right of the firstborn is his.”
“And also of the son of the bondwoman will I make a nation, because he is thy seed.”
“That in blessing I will bless thee, and in multiplying I will multiply thy seed as the stars of the heaven, and as the sand which is upon the sea shore; and thy seed shall possess the gate of his enemies;”
“And as for Ishmael, I have heard thee: Behold, I have blessed him, and will make him fruitful, and will multiply him exceedingly; twelve princes shall he beget, and I will make him a great nation.”
How Jewish commentary reads "only son"
Jewish commentators such as Rashi, an 11th-century rabbi, follow the Talmud, the collection of Jewish teaching. They read the verse as a conversation. Abraham answers that he has two sons, each the only son of his mother, and only then does God (﷾) name Isaac. So even the rabbis' reading grants that Abraham had two sons.
The classic Jewish commentary, following the Talmud (Sanhedrin 89b) and Genesis Rabbah 55:7, reads God's words as a dialogue. Told "thy son", Abraham answers that he has two sons. Told "thine only son", he answers that each is the only son of his mother. Told "whom thou lovest", he answers that he loves them both. Only then does God say "Isaac".
Abraham's other sons
Isaac and Ishmael were not Abraham's only sons in the end. Genesis records that he later took another wife, Keturah, who bore him six sons.
“Then again Abraham took a wife, and her name was Keturah. And she bare him Zimran, and Jokshan, and Medan, and Midian, and Ishbak, and Shuah.”
The order of the Qur'an's story
The Qur'an tells the story without naming the son. Abraham asks for a righteous son, receives the news of a patient boy, and later sees in a vision that he must sacrifice him. Both submit, and God (﷾) ransoms the boy. Only after the story ends does the Qur'an give Abraham the good news of Isaac. Elsewhere Isaac is promised together with his own son Jacob. Ibn Kathir, a 14th-century Muslim scholar, argues that Abraham already knew Isaac would live to have a son (11:71). So an order to sacrifice Isaac as a boy would have been no real test. Ibn Kathir and many other scholars hold that the son offered was Ishmael. This is the view most widely held by Muslims today.
“He said: "I will go to my Lord! He will surely guide me! "O my Lord! Grant me a righteous (son)!" So We gave him the good news of a boy ready to suffer and forbear. Then, when (the son) reached (the age of) (serious) work with him, he said: "O my son! I see in vision that I offer thee in sacrifice: Now see what is thy view!" (The son) said: "O my father! Do as thou art commanded: thou will find me, if Allah so wills one practising Patience and Constancy!" So when they had both submitted their wills (to Allah), and he had laid him prostrate on his forehead (for sacrifice), We called out to him "O Abraham! "Thou hast already fulfilled the vision!" - thus indeed do We reward those who do right. For this was obviously a trial- And We ransomed him with a momentous sacrifice:”
“And We gave him the good news of Isaac - a prophet,- one of the Righteous. We blessed him and Isaac: but of their progeny are (some) that do right, and (some) that obviously do wrong, to their own souls.”
“And his wife was standing (there), and she laughed: But we gave her glad tidings of Isaac, and after him, of Jacob.”
When Ishmael was sent away
Genesis places Hagar's departure after Isaac's weaning, which would make Ishmael about sixteen. Yet the same chapter has Hagar "cast the child under one of the shrubs", and the angel says "hold him in thine hand". The Islamic account places this departure much earlier. A report in Sahih al-Bukhari, a collection of the Prophet's (ﷺ) sayings, says Abraham brought Hagar to Mecca while she was still nursing Ishmael. So in the Islamic account Ishmael came to Mecca as a baby. The Qur'an places the sacrifice when he was old enough to work beside his father. It gives the news of Isaac only afterwards. On that account Ishmael was still the only son.
“And the water was spent in the bottle, and she cast the child under one of the shrubs. And she went, and sat her down over against him a good way off, as it were a bowshot: for she said, Let me not see the death of the child. And she sat over against him, and lift up her voice, and wept. And God heard the voice of the lad; and the angel of God called to Hagar out of heaven, and said unto her, What aileth thee, Hagar? fear not; for God hath heard the voice of the lad where he is. Arise, lift up the lad, and hold him in thine hand; for I will make him a great nation.”
Ibn Abbas reports that Abraham brought Hagar and her son Ishmael to the empty valley of Mecca while she was still nursing him, left them near the place of the Ka'ba with a bag of dates and a skin of water, and prayed for them. Hagar asked whether Allah had commanded this, and when he said yes, she said Allah would not abandon them.
“He said: "I will go to my Lord! He will surely guide me! "O my Lord! Grant me a righteous (son)!" So We gave him the good news of a boy ready to suffer and forbear. Then, when (the son) reached (the age of) (serious) work with him, he said: "O my son! I see in vision that I offer thee in sacrifice: Now see what is thy view!" (The son) said: "O my father! Do as thou art commanded: thou will find me, if Allah so wills one practising Patience and Constancy!" So when they had both submitted their wills (to Allah), and he had laid him prostrate on his forehead (for sacrifice), We called out to him "O Abraham! "Thou hast already fulfilled the vision!" - thus indeed do We reward those who do right. For this was obviously a trial- And We ransomed him with a momentous sacrifice:”
Abraham's life by his age
Genesis gives enough ages to lay Abraham's life out in order. He left the city of Haran for Canaan, the land God (﷾) showed him, at 75. Sarah was ten years younger, so she was about 65 when Pharaoh took her into his house. Abraham was 85, ten years into Canaan, when Hagar became his wife and conceived. He was 86 when Ishmael was born. In the Islamic account Ishmael was taken to the valley of Mecca as a baby. He was offered while still Abraham's only son, so no older than fourteen. Isaac was born when Abraham was 100 and Sarah about 90. Isaac married Rebekah at 40, when Abraham was 140. Isaac was 60 when his twin sons were born. Abraham died at 175, and Ishmael and Isaac buried him together.
“So Abram departed, as the Lord had spoken unto him; and Lot went with him: and Abram was seventy and five years old when he departed out of Haran.”
“And it came to pass, when he was come near to enter into Egypt, that he said unto Sarai his wife, Behold now, I know that thou art a fair woman to look upon: Therefore it shall come to pass, when the Egyptians shall see thee, that they shall say, This is his wife: and they will kill me, but they will save thee alive. Say, I pray thee, thou art my sister: that it may be well with me for thy sake; and my soul shall live because of thee. And it came to pass, that, when Abram was come into Egypt, the Egyptians beheld the woman that she was very fair. The princes also of Pharaoh saw her, and commended her before Pharaoh: and the woman was taken into Pharaoh’s house.”
“Then Abraham fell upon his face, and laughed, and said in his heart, Shall a child be born unto him that is an hundred years old? and shall Sarah, that is ninety years old, bear?”
“And Sarai Abram’s wife took Hagar her maid the Egyptian, after Abram had dwelt ten years in the land of Canaan, and gave her to her husband Abram to be his wife.”
“And Abram was fourscore and six years old, when Hagar bare Ishmael to Abram.”
Ibn Abbas reports that Abraham brought Hagar and her son Ishmael to the empty valley of Mecca while she was still nursing him, left them near the place of the Ka'ba with a bag of dates and a skin of water, and prayed for them. Hagar asked whether Allah had commanded this, and when he said yes, she said Allah would not abandon them.
“And Abraham was an hundred years old, when his son Isaac was born unto him.”
“And Isaac was forty years old when he took Rebekah to wife, the daughter of Bethuel the Syrian of Padan–aram, the sister to Laban the Syrian.”
“And after that came his brother out, and his hand took hold on Esau’s heel; and his name was called Jacob: and Isaac was threescore years old when she bare them.”
“And these are the days of the years of Abraham’s life which he lived, an hundred threescore and fifteen years.”
“And his sons Isaac and Ishmael buried him in the cave of Machpelah, in the field of Ephron the son of Zohar the Hittite, which is before Mamre;”
- Abraham 75
Abraham leaves Haran for Canaan.
- Abraham 86
Ishmael is born.
- Ishmael a baby
In the Islamic account, Abraham brings Hagar and Ishmael to the valley of Mecca while she is still nursing him.
- Ishmael no older than 14
The son is offered
In the Islamic account, the son is offered while he is still Abraham's only son.
- Abraham 100
Isaac is born. Sarah is about 90.
- Abraham 175
Abraham dies. Ishmael and Isaac bury him together.
The Qur'an gives Abraham the good news of Isaac only after the story of the sacrifice ends.
The answer Christians give
Hebrews 11:17 — Epistle to the Hebrews, chapter 11, verse 17
“By faith Abraham, when he was tried, offered up Isaac: and he that had received the promises offered up his only begotten son,”
Cited for
Isaac is the only son in the sense that matters: the only son of the promise, the one God chose. God said Abraham's line would be called in Isaac. Ishmael had also been sent away by then.
The response
Hebrews uses "only begotten" for Isaac in the sense of the favoured son, and some read "only" as "precious". But Genesis 22:2 says "whom thou lovest" as well. So "thine only son" is a plain fact about Abraham's family, not a word of love. On Genesis's own dates that fact was true only of Ishmael, for fourteen years. In the chapter before, God (﷾) calls Ishmael Abraham's seed and promises to make a nation of him. Being sent away did not end that: Ishmael came back to bury his father beside Isaac. Even the rabbis' reading grants that Abraham had two sons.
Where it lands — Genesis states "only son" as a fact, and on the Bible's own dates it was only ever true of Ishmael.
Perspectives
Christian reading
The son offered was Isaac, as Genesis 22 says by name. Christians explain "only son" as the son of the promise, through whom Abraham's line would be counted.
Genesis 22:2 names Isaac as the son Abraham was told to offer.
Rebuttal
Genesis 22 does name Isaac. But the same verse calls him Abraham's "only son", and by Genesis's own dates that fits only Ishmael. The Qur'an tells the story without naming the son, and gives the news of Isaac only after the story ends.
Hebrews calls Isaac Abraham's only begotten son. Christians take this with Genesis 21:12 to mean the one son of the promise.
Rebuttal
Hebrews does call Isaac Abraham's only begotten son, and Genesis 21:12 does say Abraham's line would be called in Isaac. But that makes Isaac the chosen son, not the only one. Ishmael lived to bury his father beside Isaac, and God (﷾) had promised to make him a great nation (Genesis 17:20).
Jewish reading
The son offered was Isaac. Jewish commentators explain "only son" as the only son of his mother.
Rashi follows the Talmud here. He has Abraham answer that he has two sons, each the only son of his mother, before God names Isaac.
Rebuttal
In Rashi's own conversation Abraham says he has two sons. He adds that each is the only son of his mother, words Genesis 22 does not contain. Taken plainly, "only son" fits Ishmael for the fourteen years before Isaac was born.
The Islamic perspective
The son offered was Ishmael, Abraham's firstborn. The Bible's own words "thine only son" point to him, and the Qur'an's order of events agrees.
Ishmael was born when Abraham was 86 and Isaac when he was 100, so Ishmael was fourteen years older.
Genesis calls Ishmael Abraham's son and his seed, and Ishmael was alive at Abraham's death. So Isaac was never an only son.
God (﷾) calls the son Abraham's only son three times in Genesis 22. That fits Ishmael before Isaac's birth, and was never literally true of Isaac.
By Genesis's own ages, Abraham reached Canaan at 75, had Ishmael at 86 and Isaac at 100. He died at 175, with both sons at his burial.
Abraham also had six sons by Keturah, more than by Sarah and Hagar together.
The Law of Moses forbids passing over a firstborn son because his mother is the less loved wife.
The Qur'an announces Isaac only after the sacrifice story ends, and the son offered was Ishmael.
"Thine only son" was never true of Isaac, so the name Isaac and the words beside it cannot both be right. On Genesis's own dates, the words fit only Ishmael.