Maryam (AS) was a blessed child even before she was born. As the Quran mentions in Surah Al-Imran, (verses 35-36), when Maryam’s mother had conceived her, she had vowed to Allah that the child in her womb would be devoted to His exclusive service. But when she gave birth to a female child, she said “O Lord! I have given birth to a female & Allah knew fully well what she had given birth to – a female is not the same as a male. I have named her Maryam and commit her and her offspring to you for protection from Shaitan.”
Furthermore, the Quran tells us that Allah graciously accepted Maryam and vouchsafed to her a goodly growth and placed her in the care of Zakariyah (the father of Prophet Yahya, who was also her maternal uncle). Zakariyah was the guardian of the place of worship where Maryam used to sit in her mihrab (sanctuary). She fully devoted her time to worship and pray to Allah.
Whenever Zakariyah visited her in the sanctuary, he found her provided with food. He asked her, “How did this come to you?” She said –“It’s from Allah. Allah provides sustenance to whom he wills without measure.” (Qur’an, 24:38) The sight of this pious young girl made Prophet Zakariyah yearn for a child just as virtuous and devout like Maryam. Being old, he had lost hopes of bearing an offspring. When he saw Maryam being bestowed with Allah’s blessings, he prayed fervently to Allah to bestow him with an offspring and hence Allah listened to his prayers and blessed him with Prophet Yahya, despite being of old age and barrenness of his wife.
As we move further, the Qur’an tells us –
Then came the time when the angels said: ‘O Maryam! Behold, Allah has chosen you, and made you pure, and exalted you above all the women in the world.
O Maryam! Remain devout to your Lord, and prostrate yourself in worship, and bow with those who bow (before Him).’
And when the angels said: ‘O Mary! Allah gives you the glad tidings of a command from Him: his name shall be Messiah, Isa, the son of Maryam. He shall be highly honoured in this world and in the Next, and shall be one of those near stationed to Allah.
And he shall speak to men in the cradle and also later when he grows to maturity and shall indeed be among the righteous.’
Hearing this Maryam said, “O my Lord! How shall I have a son when no man has ever touched me?’ The angel answered: Thus shall it be. Allah creates whatever He wills. When He decides something, He merely says: “Be” and it is.” (3:42-47)
Thus it was affirmed that a child would be born to Maryam despite the fact that no man had touched her and she had never been unchaste. The angel had conveyed to Mariam the glad tidings that a son would be born to her without any intimate contact and that she would bear a son like all other women of the world. The boy born would be a pure boy and a sign for the people.
When she conceived the child, she left the sanctuary and went to a distant place in order to escape the bitter criticism of the people. They would have said: Look at the virgin daughter of the pious house of Aaron! She has conceived a child and that, too, in the sanctuary where she had retired for devotion! Thus she temporarily succeeded in concealing the shame of the conception, but this event itself is a proof that Prophet Isa was born without a father. Had Maryam been married and had a husband, she would not have left his or her parents’ house by herself and chosen a distant place for the purpose of delivery.