عَن أنس قَالَ: كَانَ غُلَامٌ يَهُودِيٌّ يَخْدُمُ النَّبِيَّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ فَمَرِضَ فَأَتَاهُ النَّبِيُّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ يَعُودُهُ فَقَعَدَ عِنْدَ رَأْسِهِ فَقَالَ لَهُ: «أَسْلِمْ» . فَنَظَرَ إِلَى أَبِيهِ وَهُوَ عِنْدَهُ فَقَالَ: أَطِعْ أَبَا الْقَاسِمِ. فَأَسْلَمَ. فَخَرَجَ النَّبِيُّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ وَهُوَ يَقُولُ: «الْحَمْدُ لِلَّهِ الَّذِي أَنْقَذَهُ مِنَ النَّارِ» . رَوَاهُ البُخَارِيّ
Translation

‘Abdallah b. ‘Amr said that when a man who had been born in Medina died there, the Prophet prayed at his funeral and said, “Would that he had died somewhere else than in his birthplace!” On being asked why he had said that he replied, “When a man dies somewhere else than in his birthplace a space will be measured for him in paradise equal to the distance between his birthplace and the place where he died.” Nasa’I and Ibn Majah transmitted it.