All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
Undoubtedly, some scholars did not marry, and one scholar has written a book called: Single Scholars.
However, we should interpret this from them in the best way and excuse them with the best excuses, but their example should not be followed, as it is religiously prescribed to urge and encourage marriage, and even to order it and warn against turning away from it without a religious excuse.
Allah Says (what means): {And marry the unmarried among you and the righteous among your male slaves and female slaves. If they should be poor, Allah will enrich them from His bounty, and Allah is all-Encompassing and Knowing.} [Quran 24:32]
Anas ibn Malik narrated that the Prophet said: “Yet I pray and sleep; I fast and break my fast; and I marry women. He who is displeased with my Sunnah (practices) is not from us (i.e., is not following my way).” [Al-Bukhari and Muslim]
The jurists stated that marriage is Sunnah and that it is better than supererogatory acts of worship, and that those who fear committing Zina (fornication) must get married. Moreover, marriage is one of the causes of righteousness. Anas narrated that the Messenger of Allah, sallallaahu' alayhi wa sallam, said: “Whomsoever Allah has blessed him with a righteous wife, then Allah has certainly assisted him to fulfil half of his religion. So, he should fear Allah in the remaining half.” [Al-Hakim, at-Tabarani and al-Bayhaqi]
Therefore, if you have the financial and physical ability, you should take the initiative to marry in compliance with the Prophet's guidance and not refrain from getting married.
Abdullah ibn Mas'ood : “O young people, whoever is able to marry should marry as it helps him lower his gaze and protect his private parts (from committing illegal sexual intercourse), and whoever is not able to marry, he should fast, as fasting diminishes his sexual desires.” [Al-Bukhari and Muslim]
We point out that there is evidence indicating that Imam Al-Bukhari got married. In Siyar A'lam al-Nubala’, it was mentioned that Al-Bukhari said while addressing another person: “I have a neighbor and a spouse, and you are single.”
Allah knows best.