The Book of Prayers (Kitab Al-Salat)
Muslim :: Book 4 : Hadith 2091
It is narrated on the authority of 'Amir ibn Rabi'a (may Allah be pleased with him) that the Holy Prophet (may peace be upon him) said: Should any one of you come across a funeral procession, and if he does not intend to accompany it, he must stand up until it passes by him or is placed upon the ground before it passes him.