Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:59:3

And if not that Allah had decreed for them evacuation, He would have punished them in ˹this˺ world, and for them in the Hereafter is the punishment of the Fire.  

And had God not prescribed, ˹had He not˺ decreed, banishment for them, departure from their homeland, He would have chastised them in this world, by having them killed or taken captive, as He did with the Jews of ˹Banū˺ Qurayza, and in the Hereafter there is for them the chastisement of the Fire.
القرآن:٥٩:٣

وَلَوْلَا أَنْ كَتَبَ اللَّهُ عَلَيْهِمُ الْجَلَاءَ لَعَذَّبَهُمْ فِي الدُّنْيَا ۖ وَلَهُمْ فِي الْآخِرَةِ عَذَابُ النَّارِ  

{ولولا أن كتب الله} قضى {عليهم الجلاء} الخروج من الوطن {لعذبهم في الدنيا} بالقتل والسبي كما فعل بقريظة من اليهود {ولهم في الآخرة عذاب النار}.