Before a child is even born
The wife of ʿImrān promised what was in her womb, then found it was not what she expected.
إِذْ قَالَتِ ٱمْرَأَتُ عِمْرَٰنَ رَبِّ إِنِّى نَذَرْتُ لَكَ مَا فِى بَطْنِى مُحَرَّرًا فَتَقَبَّلْ مِنِّىٓ ۖ إِنَّكَ أَنتَ ٱلسَّمِيعُ ٱلْعَلِيمُ فَلَمَّا وَضَعَتْهَا قَالَتْ رَبِّ إِنِّى وَضَعْتُهَآ أُنثَىٰ وَٱللَّهُ أَعْلَمُ بِمَا وَضَعَتْ وَلَيْسَ ٱلذَّكَرُ كَٱلْأُنثَىٰ ۖ وَإِنِّى سَمَّيْتُهَا مَرْيَمَ وَإِنِّىٓ أُعِيذُهَا بِكَ وَذُرِّيَّتَهَا مِنَ ٱلشَّيْطَـٰنِ ٱلرَّجِيمِ
Rabbi innī nadhartu laka mā fī baṭnī muḥarraran fa-taqabbal minnī, innaka anta-s-Samīʿu-l-ʿAlīm.
[Mention, O Muḥammad], when the wife of ʿImrān said, "My Lord, indeed I have pledged to You what is in my womb, consecrated [for Your service], so accept this from me. Indeed, You are the Hearing, the Knowing." But when she delivered her, she said, "My Lord, I have delivered a female." And Allāh was most knowing of what she delivered, and the male is not like the female. "And I have named her Mary, and I seek refuge for her in You and [for] her descendants from Satan, the expelled [from the mercy of Allāh]."
Where this comes from
She had promised a son to the service of the temple. She delivered a daughter, and said so, and Allah answered that He knew better what she had delivered. The daughter was Maryam.
Source
The Qur'an · 3:35-36
- Qur'anic text in the Uthmani script via Quran.com; translation: Saheeh International