Sayyiduna Abdullah bin Abbas (may Allah be pleased with them both) says that the verse: "If you do not go forth, He will punish you with a painful punishment" [Surah al-Tawbah: 39], and His saying: "It was not for the people of Madinah and the Bedouins around them to stay behind the Messenger of Allah" [Surah al-Tawbah: 120] up to "they do" [Surah al-Tawbah: 121], both of these verses were abrogated by the verse that follows, which is: "It is not for the believers to go forth all together. Why should not a party from every group of them go forth?" [Surah al-Tawbah: 122].
Hadith Referenceالسنن الكبرى للبيهقي / كتاب السير / 17937