God had promised Abraham and Sarai he would give them a child. But instead of waiting for God's timing, they tried to make their prayers come true themselves by using a slave girl.
"Sarai said to Abram, 'Now behold, the Lord has prevented me from bearing children. Please go in to my maid; perhaps I will obtain children through her. And Abram listened to the voice of Sarai."
"Abram went in to Hagar, and she conceived; and when she saw that she had conceived, her mistress was despised in her sight. And Sarai said to Abram, 'May the wrong done me be upon you, I gave my maid into your arms, but when she saw that she had conceived, I was despised in her sight. May the Lord judge between you and me.' But Abram said to Sarai, 'Behold, you maid is in your power; do to her what is good in your sight.' So Sarai treated her harshly, and she fled from her presence."
Genesis 16:1-6
Hagar ran to the wilderness and came to a spring of water. The angel of God came and spoke to her, "Hagar, Sarai's maid, where have you come from and where are you going?"
Hagar answered, "I am fleeing from my mistress Sarai." God now told her what to do and what he would do for her.
"Return to your mistress, and submit yourself to her authority. I will greatly multiply your descendants so they will be too many to count." He also told her she would have a son, and she was to call him, Ishmael (which means "God hears") because God had seen her troubles.
Abraham and Sarai had used Hagar. She had no rights, she had no choice but to obey them. God saw what had happened and came to help her. He must have felt great pity for Hagar. Later on, when Sarai had her own son, Hagar was mistreated again. But God intervened to save her and Ishmael, and he made of Ishmael a great tribe and then a nation.
I think this is a great lesson to all Christians to wait for God to answer our prayers and not try other means that may harm someone to get what we want. All our desires should come under God's control. Both Hagar and Ishmael were hurt by the actions of Abram and Sarai.