Fiqh-us-Sunnah Volume 4, Funerals and Dhikr, Fiqh 4.046A.

Section : Persons for Whom Funeral Prayer is to be Offered.

There is a consensus among the jurists that funeral prayer is offered for all Muslims, male or female, and young or old. Ibn Al-Munzhir said: “The scholars are in agreement that if it is established that an infant is born alive, that is, by his crying, sneezing, or moving etc., then, if it dies, a funeral prayer should be offered for it.”

Al-Mughirah ibn Shu’bah reports that the Prophet, peace be upon him, said: “One may ride one’s mount behind the funeral, and walk on foot a little ahead of it or to its right or left. A funeral prayer should be offered for an aborted baby, seeking for his parents the mercy and forgiveness of Allah.” This is reported by Ahmad and Abu Daw’ud. Another narration reads: “A person on foot may walk behind a funeral, or ahead of it, or on its left side or right side or still nearer to it.” According to another report, “A rider should ride behind the funeral, whereas one on foot may walk anywhere. And a funeral prayer should be offered for a child.” This is reported by Ahmad, Nasa’i, and Tirmizhi, who consider it a sound hadith.