The Talmud discusses the honor owed to the dead (kevod ha-met) and the principle that the deceased should be treated with dignity; this underpins halakhic practices surrounding the body before burial.
מֵתוֹ וּמְשַׁמְּרוֹ — אִין, אֲבָל מְהַלֵּךְ בְּבֵית הַקְּבָרוֹת — לָא. וְהָתַנְיָא: לֹא יְהַלֵּךְ אָדָם בְּבֵית הַקְּבָרוֹת וּתְפִילִּין בְּרֹאשׁוֹ וְסֵפֶר תּוֹרָה בִּזְרוֹעוֹ וְקוֹרֵא. וְאִם עוֹשֶׂה כֵּן — עוֹבֵר מִשּׁוּם ״לוֹעֵג לָרָשׁ חֵרֵף עוֹשֵׂהוּ״. תָּנוּ רַבָּנַן: הַמּוֹלִיךְ עֲצָמוֹת מִמָּקוֹם לְמָקוֹם, הֲרֵי זֶה לֹא יִתְּנֵם בְּדִסַקַּיָּא וְיִתְּנֵם עַל גַּבֵּי חֲמוֹר וְיִרְכַּב עֲלֵיהֶם, מִפְּנֵי שֶׁנּוֹהֵג בָּהֶם מִנְהַג בִּזָּיוֹן. וְאִם הָיָה מִתְיָרֵא מִפְּנֵי גּוֹיִם וּמִפְּנֵי לִסְטִים — מוּתָּר. וּכְדֶרֶךְ שֶׁאָמְרוּ בַּעֲצָמוֹת כָּךְ אָמְרוּ בְּסֵפֶר תּוֹרָה.
The Gemara further challenges: We concluded that, in both cases, if it is his deceased relative or if he was watching over the unrelated deceased, he is exempt from mitzvot. However, one walking in a cemetery is not exempt. Wasn’t it taught explicitly in a baraita: One may not walk in a cemetery with phylacteries on his head and a Torah scroll in his arm and read from it? If one does so he commits a transgression due to the verse: “He who mocks the poor blasphemes his Creator” (Proverbs 17:5). As the deceased is incapable of fulfilling mitzvot, fulfilling a mitzva in his presence is seen as mocking him. The Gemara discusses other issues concerning the dignity of the deceased. The Sages taught: One who transports bones from place to place may not place them in a saddlebag [disakaya] and place them on the donkey’s back and ride on them, as in doing so he treats the remains disgracefully. However, if he is afraid of gentiles or highwaymen and therefore must move quickly, he is permitted to do so. And just as they said with regard to bones, so they said with regard to a Torah scroll.