The foundation of the entire levaya rests on a Rabbinic positive commandment rooted in "Love your neighbor as yourself" (Rambam, Mishneh Torah, Mourning 14:1–8), encompassing carrying the corpse on one's shoulders, walking before the bier, eulogizing, digging, and burying — a complete chain of obligations from the moment the deceased leaves the house until interment.
The moral weight of that obligation is underscored by Berakhot 18a, where Rav Yehuda teaches that one who sees the deceased being taken to burial and does not escort him transgresses the verse "He who mocks the poor blasphemes his Creator" (Mishlei 17:5), while one who does escort him is rewarded as though lending to God Himself.
The biblical prototype for a grand levaya appears in Bereishit 50:7–9, where Yosef ascended to bury his father Yaakov accompanied by all the officials of Pharaoh, Egypt's dignitaries, Joseph's household, his brothers, his father's household, chariots, and horsemen — "a very large troop" — establishing the ideal of broad communal accompaniment.
This ideal finds legal expression in the suspension of Torah study for the sake of accompanying the deceased: Shulchan Arukh, Yoreh De'ah 361:1 rules that for a scholar who taught others there is no limit — even thousands must interrupt their learning for him — while for one who merely studied but did not teach, sixty myriads in attendance suffices to exempt bystanders, and for one who neither read nor studied, the presence of any designated attendants is sufficient, with the Rema adding that in practice today we treat everyone as falling under the more stringent categories.
The physical arrangement of pallbearers and escorts around the bier is treated already in Mishnah Berakhot 3:1 and elaborated in Berakhot 17b: those carrying the bier, their replacements, and their replacements' replacements, together with those walking before and after the bier who are actually needed for it, are all exempt from reciting Shema; and the Ramban, Torat HaAdam, Inyan HaHotza'ah further specifies that those walking before the bier who are needed are also forbidden from wearing sandals, while those walking behind who are not needed remain obligated in Shema but exempt from prayer.
Regarding the order in which people exit the house, Shulchan Arukh, Yoreh De'ah 358:3 records (in the Rema's gloss) that in some communities the immediate mourners leave the house first, followed by the relatives and the bier, with more distant attendants placing the body on the bier and then the mourners and relatives lifting it onto their shoulders, after which the rest of the people take over — and Arukh HaShulchan, Yoreh De'ah 358 quotes this same custom verbatim, indicating its broad acceptance.
Kitzur Shulchan Arukh 197:8 adds a specific caution for the moment the deceased is taken out of the house: no one may walk out ahead of him, though the pallbearers who must exit first in order to receive the body are exempt from this concern.
Once the procession reaches the cemetery, the Rema in Shulchan Arukh, Yoreh De'ah 358:3 records the custom of halting the bier every four cubits before burial, and in practice today halting two or three times before reciting Tzidduk HaDin, with no halts required on days when Tzidduk HaDin is omitted.
After burial and the return from the cemetery, Mishnah Berakhot 3:2 governs those who accompanied the deceased: if they can begin and complete Shema before reaching the comforting row, they begin; if not, they do not — and those standing in the inner row facing the mourners are exempt from Shema, while those in the outer row are obligated.
A tension of precedence arises when a funeral procession encounters a bridal procession: Arukh HaShulchan, Yoreh De'ah 360 rules, following the Tur and Shulchan Arukh, that the bride takes priority and is brought under the chuppah first, after which the burial proceeds.
The Shelah HaKadosh draws the theological through-line: Shelah HaKadosh, Torah Shebikhtav, Vayechi grounds all attendance at burial and the rites of mourning in the positive commandment of "You shall walk in His ways" (Devarim 28:9), citing the Smag — just as God buries the dead, so too must we, making the levaya an act of imitatio Dei.
The Gemara in Moed Katan 27b records that the Sages instituted burial on a plain bier for all, out of concern for the dignity of the poor who could not afford elaborate biers, and that the bier may not be set down in the public thoroughfare — Rabban Gamliel himself demonstrated the principle of dignity-in-simplicity by instructing that he be buried in linen garments, a practice the entire people then adopted.
The Mishnah in Mishnah Sanhedrin 2:3 records the dispute about whether a king may follow the bier at all, with Rabbi Yehuda permitting it and citing King David walking after the bier of Avner — though the Sages reply that David did so only to appease the people, not as a normative act.
Gesher HaChaim 14:9 is not available in full text for Mekoros to read, but on our reading of the cited page, it concludes that even one who is personally exempt from interrupting Torah study or labor to accompany the deceased must nonetheless stand in honor when a funeral procession passes before him, drawing on the Jerusalem Talmud for this distinction.