All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger. We ask Allaah to exalt his mention as well as that of his family and all his companions.
Some scholars stated that Yahyah (John) refrained from getting married as he devoted himself for worship; this was permissible in his religion. Their evidence is the statement of Allaah (which means): {He was noble keeping away from sexual relations with women, a Prophet from among the righteous.}[3:39]. The correct interpretation of 'keeping away from sexual relations' is the one who refrains whilst able to have sexual relations with women and not the one who is impotent, as the context is the one of praise; one is usually praised because of a good quality that he acquired.
Some scholars also stated that 'Eesaa (Jesus) did not get married. No scholar had stated that either of these two Prophets, may Allaah exalt their mention, got married to the best of our knowledge.
Allaah knows best.