MOVING THE DEAD
Gemara
(Abaye): You cannot say that Pinchas bought a field and buried his father in it. Since the field reverts to the seller in Yovel, Elazar would be buried in someone else's land!
Makos 11b (Beraisa): If a Shogeg murderer died (and was buried in his Ir Miklat), and then the Kohen Gadol died, we take the murderer's bones and bury them near his family's burial place - "Yashuv ha'Rotze'ach El Eretz Achuzaso" refers to burial.
Rishonim
Hagahos Ashri (Mo'ed Katan 3:39): A case occurred in which a Mes was taken on Yom Tov Sheni to another city for burial. R. Tam was angry, even though there was no cemetery where he died. They should have buried him in the city, and moved him to the cemetery after Yom Tov. One should not take a Mes from a city with a cemetery to another city. One may take it to Eretz Yisrael. We do not take a Mes even from a disgraceful grave to an honorable one, but to be buried in his own we take even from an honorable one to a disgraceful one, for one wants to be buried near his fathers. If the Mes will not be guarded in this grave, i.e. there is concern lest Nochrim take it out or water will enter or it is a grave that was found, it is a Mitzvah to relocate it, due to its pain and disgrace.
Rashba (1:369, brought in Bedek ha'Bayis YD 363): If Reuven commanded at the time of his death to be buried in his fathers' gravesite, and due to Ones they could not do so immediately after he died, and they temporarily buried him near where he died, we may put plaster on the body to hasten decomposition to enable moving the bones. This is not pain to the Mes. His flesh does not feel a knife, and all the more so plaster. Embalmers cut a Mes and remove the intestines; this is not pain or disgrace. One may move it to bury it where he commanded. The Isur to move a Mes from grave to grave is when it is not for its honor. One wants to be buried with his fathers, like Yakov commanded his children. The Yerushalmi permits to move to his own gravesite, or when one was buried with intent to reinter elsewhere. A case occurred here in which one was buried in the neighborhood on a Nochri holiday when they could not bury it in the cemetery, and later they moved it to the cemetery. All the more so when he commanded to do so, it is a Mitzvah for his children to fulfill his words.
Poskim
Shulchan Aruch (YD 363:1): We do not take a Mes from one grave to another, even from a disgraceful grave to an honorable one, but to be buried in his own we take even from an honorable one to a disgraceful one, for one wants to be buried near his fathers.
Beis Yosef (DH u'Mah she'Chosav l'Chaparah): The only honor for which we move a Mes or bones is to be buried in his fathers' gravesite.
Beis Yosef (DH v'Chosav ha'Kol): Kol Bo says that we do not move a Mes, for this confounds and pains it. It fears the day of judgment. When Shmuel ha'Navi was conjured up, he said 'why did you agitate me?'
Gilyon Maharsha: Noda b'Yehudah (89) says that Rekev (the corroded remains of a Mes) does not feel confounded or pain if it is moved. The same applies to bones without flesh. Therefore, one may move them so they not remain near a Nochri. Chacham Tzvi says that fear of judgment applies even to a minor; Chavos Ya'ir said oppositely.
Pischei Teshuvah (1): Chacham Tzvi (50) says that if a Mes was buried in a Nochri's land, they may take it out to bury it in a cemetery of Yisrael. Tiferes Tzvi says that if one wants to be buried in a new cemetery, we are not concerned for disgrace to those buried in the old cemetery. One need not bear small disgrace to avoid disgrace to others. A case occurred in which Mesim were buried in land bought for 150 years, and afterwards the original owner may plow or build there. The children wanted to move them to a permanent burial site. The Noda b'Yehudah (YD 89) said that we cannot learn from the Chacham Tzvi's ruling. The current situation is less disgraceful than being buried amidst Nochrim. Also, perhaps the dead will be revived before the 150 years expire, or the children will be able to permanently buy the burial site. If we know that the Mesim could be moved towards the end of the 150 years, one may not move them now. If it is doubtful whether they could be moved later, one may move them now. In any case, future Mesim should be buried in the permanent cemetery. Once, there was a plague, and Nochri law allowed Yisre'elim to be buried in a cemetery without a wall (which is a disgrace, for they are not guarded). In six years the bodies will be removed and the place will be seeded. Most of the Mesim had families in the old cemetery of Yisre'elim, and were reinterred there. Perhaps through great effort and expenditure, the Tzibur could get the Nochrim to agree to a wall and to leave the area for a permanent cemetery. The Chasam Sofer (334) ruled that the Tzibur need not bear this expense. It is a Mitzvah to move the remaining bodies to the old cemetery. Also, since the temporary cemetery is not of Yisrael, this is like a Tzadik buried in a grave that is not his, which is disgraceful (Bava Basra 112a). The old cemetery is of the Chevra (Kadisha). Everyone buried there owns a portion.
Shulchan Aruch (ibid): Similarly, it is permitted in order to bury it in Eretz Yisrael. If he was buried in a grave with intent to be moved to another grave, it is permitted in every case.
Source: R. Yerucham, cited in Beis Yosef DH Yerushalmi. Reinterment in Eretz Yisrael is an atonement (Beis Yosef DH u'Mah she'Chosav l'Chaparah).
Shach (3): We learn from "v'Chiper Admaso Amo."
Pischei Teshuvah (2): Teshuvas Ben Chaviv (63) says that this is even if the Mes had revealed that he disapproves of moving Mesim to Eretz Yisrael (like one opinion in the Yerushalmi), his children can move him, unless he explicitly commanded that he not be taken to Eretz Yisrael.
Shulchan Aruch (ibid): If the Mes will not be guarded in this grave, i.e. there is concern lest Nochrim take it out or water will enter or it is a grave that was found, it is a Mitzvah to relocate it.
Pischei Teshuvah (3): If one bought a gravesite and someone unknowingly buried a (Nefel) miscarriage there, the owner may relocate the Nefel.
Shulchan Aruch (2): We do not take a Mes from a city in which there is a cemetery to another city, unless it is from Chutz la'Aretz to Eretz Yisrael.
Shach (4): It is a disgrace to Mesim in this city that he does not want to be buried with them.
Rebuttal (Zichron Yosef CM 9, cited by R. Akiva Eiger): If so, it would be forbidden even if the Mes commanded to do so! Rather, it is pain and disgrace to the Mes to move it a long way. Perhaps before burial the flesh will rot, or limbs will fall off, which is a disgrace. This is why when a city collects for a nearby cemetery, we collect half according to wealth, and half according to the number of people. The rich pay more because they are more concerned for disgrace than the poor.
Rema: Or, if we take it for burial where its fathers were buried.
Source (Gra 4): We learn from Makos 11b.
Keneses Yechezkeil (43, cited by Gilyon R. Akiva Eiger): Surely, if part of a family was buried in an old cemetery, one may reinter them near (the rest of) their family. The Yerushalmi says that one prefers to be buried amidst his own, even to be moved from an honorable grave to a disgraceful one. However, perhaps this is only when the only concern is that the Mes fears Yom ha'Din. However, if it was buried among other Mesim, we are concerned for their disgrace to clear a Mes from their midst. The Shulchan Aruch forbids taking a Mes from a city with a cemetery to another city, and there is even more disgrace regarding a Mes that was already buried! The Rema permits taking it for burial where its fathers were buried. Perhaps this is only before he was buried. It seems that the Rashba permits even this. Even though he gave three reasons to be lenient - he commanded, it was his fathers' gravesite, and he was buried with intent to reinter - it seems that any one of these suffices. The reason is, this is the honor of the Mes.
Rema (OC 526:8): On Yom Tov Sheni, one may bring a Mes from outside the Techum (more than 2000 Amos friom the city; normally, one may not leave the Techum on Yom Tov) to bury it in a cemetery of Yisre'elim, even though it could be buried in its place.
Magen Avraham (18): Yam Shel Shlomo says that if a Mes is in a city without a cemetery, one may move it to a city with a cemetery. This is no less than cutting myrtle for its honor. If there is a cemetery and he commanded to be taken to his fathers' gravesite, even though it is a Mitzvah to fulfill the Mes' command, and especially in a case like this, in which he wants to be buried with his fathers for his honor, it is not his honor to desecrate Yom Tov needlessly. Had he not commanded, it would be forbidden to move it to another grave. If so, his actions and command caused this. If there is concern lest the body decay, we bury it in its place. If there is no concern for decay, we leave the body and bury it after Yom Tov in his fathers' gravesite. See YD 363:2.
Machatzis ha'Shekel (18): Yam Shel Shlomo says that if he did not command, we may not reinter the body. The Magen Avraham refers to YD 363, in which we permit in order to bury in his fathers' gravesite.