Vayechi-Sefer Chasidim: Escorting the Dead
Care should be taken, when a deceased person in carried out of the house, that no one should walk in front of the coffin, as this is extremely dangerous. (Ethical Will of Rav Yehuda HaChasid *8)
What is the danger? Many explain that immediately after the separation of the soul from the body, the soul begins to go through a difficult process of judgment and evaluation. There are angels and accusers ahead of the deceased, blocking the soul’s path until it can break completely away from the body to which it was attached.
The people who escort the deceased are like soldiers who fight for the soul and can push the accusers from its path.
Others explain that one should not walk before the body because he may be caught in the judgment process that has already begun.
The above rule only applies when removing the deceased from the place in which he died. (Ramah Y”D 358:3) Some allow family members and those involved in caring for the body to walk ahead. (Ba’eir Heitev (Titkin) 368:14)