Zakariyya (as) was an abd (slave) of Allah. He was also a Prophet and he had no children for a very long time. When he realized that he was growing old and weak, he feared that there would be no one to take over from him in continuing his Dawah mission. At this point, he turned to Allah and made such a sincere and private heartfelt du’a for a child, that Allah preserved it in the Qur’an for all eternity.
The Messenger of Allah ﷺ said: “Verily, Allah has His own people among humanity.” They said, “O Messenger of Allah, who are they?” The Prophet ﷺ said, “They are the people of the Qur’an, the people of Allah and His chosen ones.” [Sunan Ibn Majah]