Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:3:39

So the angels called him while he was standing in prayer in the chamber, "Indeed, Allah gives you good tidings of John, confirming a word from Allah and ˹who will be˺ honorable, abstaining ˹from women˺, and a prophet from among the righteous."  

And the angels, namely, Gabriel, called to him, standing in the sanctuary, in the temple, at worship that (anna, means bi-anna; a variant reading has inna, implying a direct speech statement) ‘God gives you good tidings (read yubashshiruka, or yubshiruka) of John, who shall confirm a Word, being, from God, namely, Jesus, that he is God’s Spirit; he is referred to as ˹God’s˺ ‘Word’, because he was created through the word kun, ‘Be’; a lord, with a following, and one chaste, forbidden from women, and a prophet of the righteous’: it is said that he never sinned and never so intended.
القرآن:٣:٣٩

فَنَادَتْهُ الْمَلَائِكَةُ وَهُوَ قَائِمٌ يُصَلِّي فِي الْمِحْرَابِ أَنَّ اللَّهَ يُبَشِّرُكَ بِيَحْيَىٰ مُصَدِّقًا بِكَلِمَةٍ مِنَ اللَّهِ وَسَيِّدًا وَحَصُورًا وَنَبِيًّا مِنَ الصَّالِحِينَ  

{فنادته الملائكة} أي جبريل {وهو قائم يصلي في المحراب} أي المسجد {أنَّ} أي بأن وفي قراءة بالكسر بتقدير القول {الله يُبشِّرك} مثقلا ومخففا {بيحيى مصدِّقاً بكلمة} كائنة {من الله} أي بعيسى أنه روح الله وسُمي كلمة لأنه خلق بكلمة كن {وسيِّدا} متبوعا {وحصورا} ممنوعا من النساء {ونبيا من الصالحين} رُوي أنه لم يعمل خطيئة ولم يهم بها.