The fuqaha’ are unanimously agreed that it is mustahabb to bury the deceased in the graveyard of the righteous and in virtuous places. They quote a great deal of evidence for that, including the following:
It was narrated that Ibn ‘Umar (may Allah be pleased with him) said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “Whoever can manage to die in Madinah, let him die there, for I will intercede for whoever dies there.”
Narrated by al-Tirmidhi, no. 3917. He said: (|It is) hasan saheeh ghareeb. It was classed as saheeh by al-Nasaa’i in al-Sunan al-Kubra, 1/602; by Ibn ‘Abd al-Haadi in al-Saarim al-Makki, p. 96; and by Shaykh al-Albaani in al-Silsilah al-Saheehah, 4/1034
He recommended dying there but that is not in the hands of any person; rather that is up to the decree of Allah, may He be exalted. But he enjoined staying there and settling there and not leaving it, and that may be a cause of dying there. This is like the verse in which Allah, may He be exalted, says (interpretation of the meaning): “then die not except in the Faith of Islâm (as Muslims - Islâmic Monotheism)” [al-Baqarah 2:132].
Quoted from Tuhfat al-Ahwadhi, 10/286
Ibn al-Haaj said: It seems that whoever dies elsewhere then is transported and buried there will have a share of this intercession, but I did not see any shar‘i text (to that effect).
End quote from Fayd al-Qadeer, 6/70
It was narrated that ‘Umar (may Allah be pleased with him) said:
“O Allah, grant me martyrdom for Your sake and make my death in the land of Your Messenger (blessings and peace of Allah be upon him).”
Narrated by al-Bukhaari, no. 1890
Imam al-Nawawi (may Allah have mercy on him) commented on this by saying:
It is mustahabb to seek to die in a virtuous land. End quote
In fact, he included it in a chapter entitled: Chapter on the recommendation for a person to pray that his death will be in the virtuous land. End quote.
Al-Adhkaar, p. 98
Imam Maalik narrated in al-Muwatta’ (2/325) from more than one of those whom he trusted that Sa‘d ibn Abi Waqqaas and Sa‘eed ibn Zayd ibn ‘Amr ibn Nufayl died in al-‘Aqeeq and were carried to Madinah and buried there.
Ibn ‘Abd al-Barr (may Allah have mercy on him) said:
The report to that effect from Sa‘d and Sa‘eed, as was narrated by Maalik, is saheeh. End quote.
Al-Haafiz Ibn Hajar (may Allah have mercy on him) said:
There was a difference of opinion as to whether it is permissible to transport the deceased from one land to another.
It was said that it is makrooh, because it involves delaying the burial and exposing him to transgression of his sanctity.
And it was said that it is mustahabb.
Rather, it depends:
It is not allowed if there is no clear purpose, such as burying him in good places. The ruling on it being makrooh varies, and it may reach the level of being haraam.
It is mustahabb if one is close to a virtuous place, as al-Shaafa‘i stated that it is mustahabb to transport the deceased to a virtuous place, such as Makkah and elsewhere. End quote.
Fath al-Baari, 3/207
With regard to the ruling on transporting the deceased from one country to another, this has been discussed previously in the answer to question no. 8852.
And Allah knows best.