Praise be to Allah.
The Prophet (blessings and peace of Allah be upon him) encouraged marriage, and instructed and urged people to get married. Al-Bukhaari (5063) and Muslim (1401) narrated from Anas that a group of Sahaabah of the Prophet (blessings and peace of Allah be upon him) asked the wives of the Prophet (blessings and peace of Allah be upon him) about what he did in private. One of them said: I will not marry women. Another said: I will not eat meat. Another said: I will not sleep in a bed. He (the Prophet (blessings and peace of Allah be upon him)) praised and extolled Allah, then he said: “What is the matter with people who say such and such? I pray and I sleep, I fast and I break the fast, and I marry women. Whoever turns away from my Sunnah is not of me.”
Ibn Maajah (1846) narrated that ‘Aa’ishah said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “Marriage is part of my Sunnah, and whoever does not follow my Sunnah has nothing to do with me.”
Classed as hasan by al-Albaani in Saheeh Ibn Maajah.
We do not know of anyone among the Sahaabah (may Allah be pleased with them) who refrained from marriage because of seeking or spreading knowledge. The scholars among the Sahaabah, who narrated hadith, and from whom knowledge and understanding of the religion was learned, and had students who learned from them, were all married. We do not know of anyone among them who refrained from marriage or who told any of his students to do so in order to be free to learn and study, or for any other purpose.
They include the Rightly-Guided Caliphs, Abu Bakr, ‘Umar, ‘Uthmaan and ‘Ali (may Allah be pleased with them).
They also include the commanders of armies, such as ‘Amr ibn al-‘Aas, Abu ‘Ubaydah ibn al-Jarraah, Khaalid ibn al-Waleed, Shurahbeel ibn Hasanah and others (may Allah be pleased with them all).
The same is true of most of the Sahaabah who narrated Prophetic hadith, such as Abu Hurayrah, Abu Sa‘eed, Anas ibn Maalik, ‘Abdullah ibn ‘Umar, ‘Abdullah ibn ‘Abbaas, ‘Abdullah ibn ‘Amr and others (may Allah be pleased with them all).
At-Tirmidhi (3790) narrated that Anas ibn Maalik said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “The most compassionate of my ummah towards my ummah is Abu Bakr; the strictest of them in adhering to the command of Allah is ‘Umar; the most sincere of them in modesty is ‘Uthmaan ibn ‘Affaan; the most knowledgeable of them about halaal and haraam is Mu‘aadh ibn Jabal; the most knowledgeable about shares of inheritance is Zayd ibn Thaabit; the most knowledgeable of them about recitation of Qur’an is Ubayy ibn Ka‘b. Every nation has a trustee, and the trustee of this ummah is Abu ‘Ubaydah ibn al-Jarraah.”
Classed as saheeh by al-Albaani in Saheeh at-Tirmidhi
All of these men got married, including Mu‘aadh ibn Jabal, the most knowledgeable of this ummah about halaal and haraam.
Whoever seeks knowledge will find out that part of the knowledge that he seeks encourages and urges people to get married.
The one who combines pursuit of knowledge with marriage has combined two good things and is following the example of the leaders of Islam, the Sahaabah and Taabi‘een, and those who followed them in truth.
And Allah knows best.