According to a literal interpretation of the text:
It depends on what you mean by wrong. Looking at the narrative totally and literally, Abraham could not have known that the promised nation would come through Sarah's offspring, since God did not tell him that until after the birth of Ishmael. In Genesis 12, God promises Abram three (main) things:
- I will show you a land, Canaan, which I will give to your descendants.
- I will make you a nation
- I will bless you.
God continues to make these promises clearer as the narrative continues. In Genesis 13, God elucidates
- I will give the land, Canaan, to you and your descendants forever.
- I will make your descendants number greater than the sands of the Earth you can count.
Note that these aren't strictly new promises. God is revealing his plan to Abram as he is carrying it out. God has not revealed to Abram how these things will come about, but only "I will do this." Up to this point, Abram has no children, he is getting older, and so is his wife. Genesis 15 reveals that as far as Abram knew, a servant of his would inherit his estate, since he had no son. It's not until this point, many years after he originally revealed himself to Abram, that God actually promises a son to Abram. He says:
This man will not be your heir; but one who will come forth from your own body, he shall be your heir.” And He took him outside and said, “Now look toward the heavens, and count the stars, if you are able to count them.” And He said to him, “So shall your descendants be.” Then he believed in the Lord; and He reckoned it to him as righteousness.
So, God further specifies his promises to Abram. Only now does he begin to reveal to Abram how his plan will come to pass:
- I will make for you an heir of your own body.
- I will make your descendants number greater than the stars you can count.
- Your descendants will sojourn in a foreign land for 400 years, where they will be oppressed and enslaved.
- They will come out of oppression with many possessions.
- You will die at an old age, at peace.
- This will happen from this place in the fourth generation.
Abram had received promises from God before, but notice that it's on this day that God makes a covenant with Abram. A covenant is different than a promise, as a covenant is an agreement of a legal nature that holds both sides of the agreement to certain terms. The terms of the covenant have not yet been revealed, or at least the terms of the covenant at that point are not described as to go beyond the ritualistic practice of the animal sacrifice described in the passage.
Now, Sarai's barrenness and Hagar her maidservant only just now come full view into the narrative in Genesis 16. Abram has been living in Canaan for ten years at this point. He's eighty-six years old- sixteen years older than his father was when he and his brothers were born. God has not yet told him when his heir would be born. God has not yet told him by whom his heir would be born. As far as we can know, the terms up to this point of the covenant God made with Abram did not include Sarai. Given the practice described in the question, Abram was just trying to accomplish something according to the promise of God that he had no power to do himself. Only God could make Abram into a nation, Abraham's vanity was to think he could do it himself. In the same way, only God can bring us into that nation, our vanity is to think we can do it ourselves.
A resounding truth pops out of the text in regard to your question, and it can be observed in almost every other biblical narrative: God often withholds specific instruction. He obscures and hides the totality of his plan, always leaving room for men to act righteously or unrighteously. Had Abram acted righteously, with perfect patience, we would be discussing his only son, Isaac. But graciously and thankfully for Abram, it is belief that God counts as righteousness, and not perfect right action. Indeed, God ignores Abram's unrighteous impatience when he says (in Gen 22:2), "Take your only son up to the mountain..."
We see fully the blunder of Abram's impatience because we can count its consequences- we have the benefit of bearing whiteness to The Heir According to the Promise, Jesus, who is the Messiah. Because we have seen him and known him, we know that the heir could not have been of Ishmael because he was not- it was by Isaac that Abraham's seed, who is Messiah, was born according to Sarah's freedom and the miraculous power of God, and not as a result of Hagar's bondage and the impatience of flesh. Abram did not know this, as God did not reveal it to him until after Ishmael's birth, in Genesis 17.