"And Joseph took an oath of the children of Israel,... ye shall carry up my bones from hence (Gen. 1. 25). Rabbi Chanena said, " There is a reason for this oath. As Joseph knew that he was perfectly righteous, why then, if the dead are to rise in other countries as well as in the land of Israel, did he trouble his brethren to carry his bones four hundred miles? The reply is, " He feared lest, if buried in Egypt, he might have to worm his way through subterranean passages from his grave into the land of Israel."
Why Joseph Made Israel Swear to Carry His Bones Home
Ketubot 111a