it was prophecied in the earlier scriptures too:
And the water was spent in the bottle, and she cast the child under one of the shrubs.
16And 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.
17And 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.
18Arise, lift up the lad, and hold him in thine hand; for I will make him a great nation. 19And God opened her eyes, and she saw a well of water; and she went, and filled the bottle with water, and gave the lad drink.
Genesis 21:15-19
Sing, O barren, thou
that didst not bear; break forth into singing, and cry aloud, thou
that didst not travail with child:
for more are the children of the desolate than the children of the married wife, saith the LORD. ......
......For the LORD hath called thee as a woman forsaken and grieved in spirit,
and a wife of youth, when thou wast refused, saith thy God.
7For a small moment have I forsaken thee; but with great mercies will I gather thee.
8In a little wrath I hid my face from thee for a moment; but with everlasting kindness will I have mercy on thee, saith the LORD thy Redeemer.
Isaiah 54: