Bismillahir rahmanir raheem
We don’t know a lot about the life of Zakariyya (as) until he is a very old man. He wasn’t a rich man but he always helped those in need. Zakariyyah (as) had no children and both he and his wife were old. He was worried that after him, there would be no one to continue the dawah to the people. SubhanAllah, what a noble man.
Knowing that nothing is beyond the power of Allah swt, he made dua’a for a son. We find his dua’a in Surah Al-Iman ayahs 38-41.
“At that, Zakariyyah called upon his Lord, saying, “My Lord, grant me from Yourself a good offspring. Indeed, You are the Hearer of supplication.”
So the angels called him while he was standing in prayer in the chamber, “Indeed, Allah gives you good tidings of John (Yahya), confirming a word from Allah and [who will be] honorable, abstaining [from women], and a prophet from among the righteous.”
He said, “My Lord, how will I have a boy when I have reached old age and my wife is barren?” The angel said, “Such is Allah ; He does what He wills.”
He said, “My Lord, make for me a sign.” He Said, “Your sign is that you will not [be able to] speak to the people for three days except by gesture. And remember your Lord much and exalt [Him with praise] in the evening and the morning.”
Nothing is impossible for Allah swt. Zakariyya (as) was a man who was grateful to Allah swt for everything he had. He also had right intentions when asking Allah swt for a child. He didn’t want a child for bragging purposes but to serve Allah swt. To carry on his work and continue to give dawah to the people who needed guidance.
If you want something from Allah swt, you just have to ask for it. Allah swt is shy of his slave who asks from Him and if He doesn’t give it to you in this life, rest assured He swt has reserved better for you in the afterlife or averts some other kind of calamity from your life now.
We also see from this story that we need to have sincere intentions when we ask of Allah swt. He swt knows what is in our hearts, so there’s no use trying to fool Him. He swt is the All-Seeing and All-Aware, He swt knows everything you do.