Maryam, who was chosen to give birth to Jesus (as), was born at a time of disorder when the Children of Israel placed all their hopes on a Messiah's coming. Totally unaware of being the centre of all hopes, Maryam was specially chosen by Allah for this blessed duty and brought up accordingly. Maryam came from a noble family, the family of ‘Imran. Allah chose this family over the rest of all people.
The members of the family of ‘Imran were known to be people having deep faith in Allah. They turned to Him while doing all their deeds and meticulously observed His limits. When ‘Imran's wife learned that she was pregnant, she turned to her Creator and prayed, and she devoted what was in her womb to the service of Allah. Allah gives an account of this in the Qur'an:
Remember when the wife of ‘Imran said, "my Lord, I have pledged to You what is in my womb, devoting it to Your service. Please accept my prayer. You are the All-Hearing, the All-Knowing." When she gave birth, she said, "My Lord! I have given birth to a girl" - and Allah knew very well what she had given birth to, male and female are not the same - "and I have named her Maryam and placed her and her children in Your safekeeping from the accursed shaytan." (Surah Al ‘Imran: 35-36)
When Maryam was born, Imran's wife sought only the good pleasure of Allah. She turned to Allah and placed Maryam and her children in His safekeeping from the accursed shaytan. In return for her sincerity and prayer, Allah gave Maryam noble virtues. In the Qur'an, Allah explains how Maryam was brought up under His protection and meticulous care. "Her Lord accepted her with approval and made her grow in health and beauty." (Surah Al ‘Imran: 37) Zakariyya (Zachariah) became Maryam's guardian and during the time she spent with him, he realised that she was favoured with exceptional qualities. Moreover, Allah showed her many favours "without any reckoning":
…Every time Zakariyya visited her in the Upper Room, he found food with her. He said, "Maryam, how did you come by this?" She said, "It is from Allah. Allah provides for whomever He wills without any reckoning." (Surah Al ‘Imran: 37)
Just as Allah chose the family of ‘Imran, He also chose Maryam, a member of ‘Imran’s family, and provided her with an exceptional upbringing. Allah purified Maryam and chose her over all other women. This attribute of hers is stated in the Qur'an as follows:
And when the angels said, "Maryam, Allah has chosen you and purified you. He has chosen you over all other women. Maryam, obey your Lord and prostrate and bow with those who bow." (Surah Al ‘Imran: 42-43)
In the community in which she lived, Maryam became a person known for the loyalty and sincerity she showed to Allah. She is especially distinguished as a woman "who guarded her chastity." In Surat at-Tahrim, we find an account of this:
(Allah has made an example for those who believe) Maryam, the daughter of ‘Imran, who guarded her chastity - We breathed Our Spirit into her and she confirmed the Words of her Lord and His Book and was one of the obedient. (Surat at-Tahrim: 12)