Bulugh al-Maram
Abu Sa’id (RAA) narrated that the Messenger of Allah (ﷺ) said, "Stand up when you see a funeral procession, and he who accompanies it should not sit down until the coffin is placed on the ground." Agreed upon.
وَعَنْ أَبِي سَعِيدٍ - رضى الله عنه - أَنَّ رَسُولَ اَللَّهِ - صلى الله عليه وسلم -قَالَ: { إِذَا رَأَيْتُمُ الْجَنَازَةَ فَقُومُوا, فَمَنْ تَبِعَهَا فَلَا يَجْلِسْ حَتَّى تُوضَعَ } مُتَّفَقٌ عَلَيْه ِ 1 .
Reference