According to the Book of Genesis, Hagar was an Egyptian slave, a handmaiden of Sarah (then known as Sarai), whom Sarah gave to her own husband Abram (later renamed Abraham) as a wife to bear him a child. Abraham's firstborn son, through Hagar, Ishmael, became the progenitor of the Ishmaelites, generally taken to be the Arabs. Various commentators have connected her to the Hagrites (sons of Agar), perhaps claiming her as their eponymous ancestor. Hagar is alluded to, although not named, in the Quran, and Islam considers her Abraham's second wife.
According to the Bible, Hagar was the Egyptian slave of Sarai, Abram's wife (whose names later became Sarah and Abraham). Sarai had been barren for a long time and sought a way to fulfill God's promise that Abram would be father of many nations, especially since they had grown old, so she offered Hagar to Abram to be his concubine.
Hagar became pregnant, and tension arose between the two women. Genesis states that Hagar despised Sarai after she had conceived and "looked with contempt" on her. Sarai, with Abraham's permission, eventually dealt harshly with Hagar and so she fled.
Hagar fled into the desert on her way to Shur. At a spring en route, an angel appeared to Hagar, who instructed her to return to Sarai and submit to her mistress, so that she may bear a child who "shall be a wild ass of a man: his hand shall be against every man, and every man's hand against him; and he shall dwell in the face of all his brethren" (Genesis 16:9 - 12). Then she was told to call her son Ishmael. Afterward, Hagar referred to God as "El Roi" (variously "god of sight"; "god saw me"; "god who appears"). She then returned to Abram and Sarai, and soon gave birth to a son, whom she named as the angel had instructed.
There is no direct mention of Hagar in the Quran, which does not declare her explicitly a free woman or as a maid of Sarah or Abraham. Moreover, the notion of Hagar being a slave girl is denied by some modern scholars, who posit instead that Hagar was the daughter of the pharaoh of Egypt, thus making her a princess rather than a slave girl or a bondswoman.