Hadithcore
Al-Adab Al-Mufrad, 780
sahih· Al-Albani

Abu 'Izza Yassar ibn 'Abdullah al-Hudhali reported that the Prophet, (ﷺ), said, "When Allah wants a slave to die in a particular country, he makes him have some reason for being there."

حَدَّثَنَا مُسَدَّدٌ، قَالَ‏:‏ حَدَّثَنَا إِسْمَاعِيلُ، عَنْ أَيُّوبَ، عَنْ أَبِي الْمَلِيحِ بْنِ أُسَامَةَ، عَنْ أَبِي عَزَّةَ يَسَارِ بْنِ عَبْدِ اللهِ الْهُذَلِيِّ، عَنِ النَّبِيِّ صلى الله عليه وسلم قَالَ‏:‏ إِنَّ اللَّهَ إِذَا أَرَادَ قَبْضَ عَبْدٍ بِأَرْضٍ، جَعَلَ لَهُ بِهَا، أَوْ‏:‏ فِيهَا أ حَاجَةً‏.‏

References2 variants
In-Book Reference
Book 33, Hadith 27
English Reference
Book 33, Hadith 780