Imran was the son of Mathan, who was from the progeny of Sulaiman son of Dawood (a.s). The children of Mathan and especially Imran were among the leading religious scholars of Bani Israel. They were residing in Baitul Maqdas. Imran’s wife was Hannah. Both grew old but remained issueless. They wished so earnestly to have children who would keep their memory alive after them and who would continue their holy progeny further.
One day Hannah was sitting under a tree. She saw that a female bird was feeding her chick. This aroused in her the female instinct of becoming a loving mother. She exclaimed, “Would that I too had a child whom I would have fed in my lap with affection.” At that moment she prayed to God in full earnestness and humility, “My Lord! Grant me a child through Your bountiful grace, whom if granted I will dedicate to serve the Baitul Maqdas.”
It was a custom in those days to seek children from God and when granted to entrust the newborns to the trustees of Baitul Maqdas. This made their parents free from their responsibility of caring, training and nourishing. After reaching the age of puberty such children were free either to continue serving Baitul Maqdas or to lead a life of their own choice in the society, and to look after their parents like common people. Such dedication was only in case of male children, not for daughters, because after puberty, girls have menses, which debarred them from the house of God. So female children were excepted.
Almighty Allah answered Hannah’s prayer whereupon she became pregnant despite old age. But before delivery Imran passed away. The pious lady was extremely sorrowful due to the death of her dear husband and was feeling lonely and helpless. One day she raised her hands towards the sky and prayed to God,
“My Lord! I will give away the child in my womb to serve the House of God. Please accept my prayer, as You are the Hearer, the Knower.” After some time when the child was born it was found that God had granted her a daughter instead of a son. So she again exclaimed, “My Lord! You have granted me a daughter. Your will is always meaningful. You know well that had it been a son it would have been lower than this daughter in nobility.” Then she added, “I have named her Maryam. I seek from Your Holy Self to keep this girl and her progeny from the evil of the devil Satan.”
In view of the sincerity and firm desire of Hannah, Almighty Allah accepted her offer and adorned her daughter with all virtues of piety, chastity and modesty. God granted the noble lady, Maryam such a high rank the mention whereof will remain in the Bible and the Quran till eternity.
All of a sudden it struck to the mother of Maryam (through Revelation) that God had accepted her offering and had honored her exceptionally by allowing her daughter (in place of a son) to have the honor of serving the House of God. This revelation gave peace of mind to Maryam’s mother and she very happily started to arrange the fulfillment of her pledge by dedicating her fortunate daughter to the House of God.
A few days thereafter she wrapped her daughter in a clean cloth and took her to the trustees of Baitul Maqdas who were from the progeny of Harun (a.s). Entrusting the daughter to them she said, “Take this child in your custody because I had made a vow that I will give her away for serving the House of God.” Then she returned home.
The leading personalities of Bani Israel who were the trustees of Baitul Maqdas accepted the female child, which had been dedicated to the House of God. Then there arose a problem as to who from them would nourish the child. They held mutual consultations. Everyone wished to take the responsibility and they began to show their eagerness because the child was the daughter of Imran whom everyone among Bani Israel held high in esteem and everyone intended to get nearer to him.
At this point, Prophet Zakaria said, “I am the husband of Maryam’s aunt and therefore my right is more. This honor may be given to me.” But the elders did not accept this claim as no one wanted to miss the honor.
After long discussions it was agreed that arguments and counter arguments and claims upon claims would not solve the problem so they should instead draw lots. They decided to throw their pens in water with which they wrote the holy words of Torah and one whose pen does not sink would have the honor of maintaining and nourishing Maryam. Zakaria turned out to be that fortunate person. Being her aunt’s husband, Zakaria began take care of Maryam to the best of his ability.
The Quran mentions this as follows:
When a woman of Imran said: My Lord! Surely I vow to Thee what is in my womb, to be devoted (to Thy service); accept therefore from me, surely Thou art the Hearing, the Knowing.
So when she brought forth, she said: My Lord! Surely I have brought it forth a female- and Allah knew best what she brought forth- and the male is not like the female, and I have named it Maryam, and I commend her and her offspring into Thy protection from the accursed Shaitan.
So her Lord accepted her with a good acceptance and made her grow up a good growing, and gave her into the charge of Zakaria;
When Maryam attained puberty she saw with wonder that she was quite different from other women of the world in that she did not have monthly periods; she was clean throughout the year. Ever since she had reached the age of understanding, she had passed almost all her time in worship. Her radiant face, her modesty and her symmetrical physique had made her very awful in the eyes of everyone. Her humility and righteousness had become the talk of the town. Every young and old, man and woman looked at her and referred to her with awful respect. Even the trustees of the Baitul Maqdas, including Zakaria, behaved with her with utmost respect. They considered themselves fortunate to accord respect and honor to Maryam.
When Maryam became major, Zakaria arranged for her a separate room on the first floor of Baitul Maqdas so that she may not have to mingle with males and that she may engage in her devotional occupations with maximum concentration. None was allowed to approach Maryam or to see and talk with her. Only Zakaria could visit her, to look after her requirements.
One day when Zakaria entered the room of Maryam he was stunned to see some fruits before her, which did not appear to be the fruits of this world. He did not say anything. The next day also he observed the same phenomenon. Then he asked, “O Maryam! From where do you get this food?” Maryam replied, “These fruits have come from Almighty God. God grants limitless provision to whomsoever He wishes.”
According to the Quran:
Whenever Zakaria entered the sanctuary to (see) her, he found with her food. He said: O Maryam! Whence comes this to you? She said: It is from Allah. Surely Allah gives to whom He pleases without measure.
Zakaria understood and he was quite convinced that Maryam had won the pleasure of her Lord and that she was higher in rank than all the women. So he paid even more respect and honor to her thenceforth. He considered himself very fortunate on this account.
Now came a time when angels began to visit Maryam and converse with her. One day when she was busy worshipping God, angels arrived and told her, “O Maryam! God has kept you clean and pious and granted you greatness over all other women of the world. O Maryam! Perform Prayer when others do so and remember Me in Supplications and bow and prostrate for Me.”
These are the events which show how a pious and modest teenaged girl attained spiritual ranks and became a darling of God and how a young daughter passed thirteen years in the House of God under the care of a prophet of God. This became a remarkable instance in human history. So, after 600 years, Almighty Allah retold this event to Muhammad (s.a.w.s.) saying:
This is of the announcements relating to the unseen, which We reveal to you; and you were not with them when they cast their pens (to decide) which of them should have Maryam in his charge, and you were not with them when they contended one with another.
 In those days Maryam meant a devout worshipper
 Surah Aale Imran 3:35-37
 Surah Aale Imran 3:37
 Surah Aale Imran 3:44
source : alhassanain