Hadithcore
Hadith #2312790
sahih· Al-Albani

Abu'l-Malih reported from one of his people (who was a Companion) that the Prophet, (ﷺ), said, "When Allah wants one of His slaves to die in some land, he makes him have a reason for going there."

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

References2 variants
Sunnah.com reference
Book 55, Hadith 1
Arabic/English book reference
Book 55, Hadith 1282