ENOfficial
Matar b. ‘Ukamis reported God’s messenger as saying, “When God decrees that someone should die in a certain land, He gives him a reason for going there." Ahmad and Tirmidhi transmitted it.
Source: sunnah.com
Other translations
Arabic
وَعَن مطر بن عكام قَالَ: قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: «إِذَا قَضَى اللَّهُ لِعَبْدٍ أَنْ يَمُوتَ بِأَرْضٍ جَعَلَ لَهُ إِلَيْهَا حَاجَةً» . رَوَاهُ أَحْمَدُ وَالتِّرْمِذِيّ
sunnah.com