Tafsir Ibn Kathir -> Surah At-Taubah -> Allah the Exalted here explains His order to Muslims to march forth with the Messenger of Allah for the battle of Tabuk.

We should first mention that a group of the Salaf said that marching along with the Messenger , when he went to battle, was at first obliged on all Muslims, because, as they say, Allah said,

﴿انْفِرُواْ خِفَافًا وَثِقَالاً﴾

(March forth, whether you are light or heavy) ﴿9:41﴾, and,

﴿مَا كَانَ لأَهْلِ الْمَدِينَةِ وَمَنْ حَوْلَهُمْ مِّنَ الاٌّعْرَابِ﴾

(It was not becoming of the people of Al-Madinah and the bedouins of the neighborhood...) ﴿9:120﴾. However, they said, Allah abrogated this ruling (9:41 and 9:120) when He revealed this Ayah, ﴿9:122﴾. However, we could say that this Ayah explains Allah's order to participate in battle on all Arab neighborhoods, that at least a group of every tribe should march for Jihad. Those who went with the Messenger would gain instructions and studies in the revelation that came down to him, and warn their people about that battle when they returned to them. This way, the group that went with the Prophet will achieve both goals ﴿Jihad and learning the revelation from the Prophet ﴾. After the Prophet , a group of every tribe or neighborhood should seek religious knowledge or perform Jihad, for in this case, Jihad is required from at least a part of each Muslim community. `Ali bin Abi Talhah reported from Ibn `Abbas about the Ayah,

﴿وَمَا كَانَ الْمُؤْمِنُونَ لِيَنفِرُواْ كَآفَّةً﴾

(And it is not (proper) for the believers to go out (to fight - Jihad) all together. ) "The believers should not all go to battle and leave the Prophet alone,

﴿فَلَوْلاَ نَفَرَ مِن كُلِّ فِرْقَةٍ مِّنْهُمْ طَآئِفَةٌ﴾

(Of every troop of them, a party only should go forth) in the expeditions that the Prophet sent. When these armies returned to the Prophet, who in the meantime received revealed parts of the Qur'an from Allah, the group who remained with the Prophet would have learned that revelation from him. They would say, `Allah has revealed some parts of the Qur'an to your Prophet and we learned it.' So they learned from them what Allah revealed to His Prophet in their absence, while the Prophet sent some other men into military expeditions. Hence Allah's statement,

﴿لِّيَتَفَقَّهُواْ فِى الدِّينِ﴾

(that they may get instructions in religion,) so that they learn what Allah has revealed to their Prophet and teach the armies when they return,

﴿لَعَلَّهُمْ يَحْذَرُونَ﴾

(so that they may beware.)'' Mujahid said, "This Ayah was revealed about some of the Companions of the Prophet who went to the desert and were helped by its residents, had a good rainy year and called whomever they met to guidance. The people said to them, `We see that you left your companions and came to us.' They felt bad in themselves because of this and they all came back from the desert to the Prophet . Allah said,

﴿فَلَوْلاَ نَفَرَ مِن كُلِّ فِرْقَةٍ مِّنْهُمْ طَآئِفَةٌ﴾

(Of every troop of them, a party only should go forth,) those who seek righteousness ﴿such as to spread the call of Islam, while others remain behind﴾,

﴿لِّيَتَفَقَّهُواْ فِى الدِّينِ﴾

(that they may get instructions in (Islamic) religion,) and learn what Allah has revealed,

﴿وَلِيُنذِرُواْ قَوْمَهُمْ﴾

(and that they may warn their people), when those who went forth returned to them,

﴿لَعَلَّهُمْ يَحْذَرُونَ﴾

(so that they may beware (of evil).)'' Qatadah said about this Ayah, "It is about when the Messenger of Allah sent an army; Allah commanded them to go into battle, while another group remained with the Messenger of Allah to gain instructions in the religion. Another group returns to its own people to call them (to Allah) and warn them against Allah's punishment of those who were before them.'' It was also said that this verse,

﴿وَمَا كَانَ الْمُؤْمِنُونَ لِيَنفِرُواْ كَآفَّةً﴾

(And it is not (proper) for the believers to go out all together.) is not about joining Jihad. They say that the Messenger of Allah invoked Allah against Mudar to try them with years of famine, and their lands were struck by famine. The various tribes among them started to come, entire tribes at a time, to Al-Madinah, because of the hardship they faced and they would falsely claim that they are Muslims. This caused hardship for the Companions of the Messenger and Allah revealed to him that they are not believers. The Messenger of Allah sent them back to their tribes and warned their people not to repeat what they did. Hence Allah's statement,

﴿وَلِيُنذِرُواْ قَوْمَهُمْ إِذَا رَجَعُواْ إِلَيْهِمْ﴾

(and that they may warn their people when they return to them,)

﴿يَأَيُّهَا الَّذِينَ ءَامَنُواْ قَاتِلُواْ الَّذِينَ يَلُونَكُمْ مِّنَ الْكُفَّارِ وَلِيَجِدُواْ فِيكُمْ غِلْظَةً وَاعْلَمُواْ أَنَّ اللَّهَ مَعَ الْمُتَّقِينَ ﴾

(123. O you who believe! Fight those of the disbelievers who are close to you, and let them find harshness in you; and know that Allah is with those who have Taqwa.)