Several years had passed by since God's promise to Abraham (then Abram) that he would make his offspring so numerous they couldn't be counted, but he and Sarah (then Sarai) still didn't have any children. It was customary at the time among the people of Mesapotamia for a barren wife to have her handmaid bear children, which prompted Sarah to suggest a similar solution.
Now Sarai, Abram's wife, had borne him no children. But she had an Egyptian maidservant named Hagar; so she said to Abram, "The Lord has kept me from having children. Go, sleep with my maidservant; perhaps I can build a family through her." Abram agreed to what Sarai said. (Genesis 17:1-2)
Abram agreed. He slept with the servant woman who conceived. When Hagar realized that she was pregnant, she began to think of herself as very important and started being rude to Sarai who, in turn, began to treat Hagar so unkindly, the servant woman ran away in despair. But an angel came to Hagar in the desert and advised her to return home.
Hagar returned and gave birth to Ishmael. When Ishmael was 13, Isaac was born to Sarah. At a feast thrown to mark the weaning of Isaac, Ishmael appeared to mock Sarah who furiously told Abraham to evict both the boy and his mother. The matter distressed Abraham, but was told by God to allow it to happen, and so the following day Abraham gave them food and water and sent them on their way.
When Hagar ran out of water in the desert of Beersheba, Ishmael, exhausted with his journey and faint from thirst, seemed about to die. Hagar placed Ishmael under the shade of a bush, and wandered off a distance away not wanting to see her son die. But...
Then the angel of the Lord told her, "Go back to your mistress and submit to her." The angel added, "I will so increase your descendants that they will be too numerous to count."
The angel of the Lord also said to her:
"You are now with child
and you will have a son.
You shall name him Ishmael,
for the Lord has heard of your misery.
He will be a wild donkey of a man;
his hand will be against everyone
and everyone's hand against him,
and he will live in hostility
toward all his brothers."
God heard the boy crying, and the angel of God called to Hagar from heaven and said to her, "What is the matter, Hagar? Do not be afraid; God has heard the boy crying as he lies there. Lift the boy up and take him by the hand, for I will make him into a great nation." Then God opened her eyes and she saw a well of water. So she went and filled the skin with water and gave the boy a drink.
Saved by God, Hagar raised her son in the desert of Paran. Later she helped him find a wife from Egypt, after which Hagar passes out of the story.