Ibn Isḥāq transmitted—on the authority of the teachers from whom he received the story of Uḥud—that Safiyyah came forward to look upon Ḥamzah, her full brother. The Messenger of Allah ﷺ therefore said to her son, al-Zubayr, “Meet her and send her back; let her not see what has happened to her brother.” Al-Zubayr met her and said, “Mother, the Messenger of Allah ﷺ instructs you to return.” She replied, “Why should I? I have been told that my brother has been mutilated. That is in the cause of Allah, and we are content with what has occurred. I shall seek the reward and be patient, if Allah wills.” Al-Zubayr went back and informed the Prophet ﷺ of her words, whereupon he said, “Then let her proceed.” She came, looked at Ḥamzah, said, “We belong to Allah and to Him we return,” sought forgiveness for him, and then he ordered that he be buried.
Abū Bakr ibn ʿAyyāsh reported—from Yazīd ibn Abī Ziyād, from Maqsim, from Ibn ʿAbbās—that when Ḥamzah was killed Safiyyah approached, and ʿAlī and al-Zubayr pretended not to recognize her. She went to the Prophet ﷺ, and he said, “I fear for her reason.” He placed his hand upon her chest and prayed for her; she recited istirjāʿ and wept. The Prophet ﷺ then came and stood over Ḥamzah, who had been mutilated, and said, “Were it not for women’s grief I would leave him until he is raised from the crops of birds and the bellies of beasts.” He then ordered that the fallen be brought forward; he offered the funeral prayer over them with seven takbīrs, they would be removed while Ḥamzah remained, then another group of seven would be brought and he would pronounce seven takbīrs over them—until he had completed them all.
The report of Jābir stating that the Prophet ﷺ did not pray over them is more authentic.
In the two Ṣaḥīḥs there is a narration of ʿUqbah ibn ʿĀmir that the Prophet ﷺ offered the funeral prayer for those killed at Uḥud as one prays over the deceased. Allah knows best.
ʿUthmān ibn ʿUmar and Rūḥ ibn ʿUbādah, with the isnād cited by al-Ḥākim in al-Mustadrak to them, related: "Usāmah ibn Zayd narrated to us, from al-Zuhrī, from Anas…"