Performing the funeral prayer is prescribed for both men and women:
عَنْ أَبِي هُرَيْرَةَ رَضِيَ اللَّهُ عَنْهُ، عَنِ النَّبِيِّ ﷺ قَالَ: «مَنْ شَهِدَ الْجَنَازَةَ حَتَّى يُصَلِّيَ فَلَهُ قِيرَاطٌ، وَمَنْ شَهِدَهَا حَتَّى تُدْفَنَ كَانَ لَهُ قِيرَاطَانِ». قِيلَ: وَمَا الْقِيرَاطَانِ؟ قَالَ: «مِثْلُ الْجَبَلَيْنِ الْعَظِيمَيْنِ».
It is narrated from Abu Hurayrah (may Allah be pleased with him) that the Prophet ﷺ said:
“Whoever attends the funeral until the prayer is offered will have one qirat of reward, and whoever stays until the burial is completed will have two qirats.”
It was asked, “What are the two qirats?” He said, “Like two great mountains.”
(Sahih al-Bukhari, 1325)
Translation:
Abu Hurayrah (may Allah be pleased with him) reported that the Prophet ﷺ said:
“Whoever is present at the funeral prayer until it is performed will receive one qirat of reward; and whoever remains until the burial is finished will receive two qirats.”
It was asked: “What are the two qirats?”
He replied: “Like two great mountains.”
As for women following the funeral procession:
عَنْ أُمِّ عَطِيَّةَ قَالَتْ: نُهِينَا عَنِ اتِّبَاعِ الْجَنَائِزِ، وَلَمْ يُعْزَمْ عَلَيْنَا.
It is narrated from Umm ‘Atiyyah (may Allah be pleased with her) who said:
“We were forbidden to follow funeral processions, but it was not made strictly forbidden for us.”
(Sahih al-Bukhari, 1278; Sahih Muslim, 938)
The majority of hadith scholars (of the Shafi‘i, Maliki, and Hanbali schools) have said that women are discouraged (makruh) from accompanying the funeral procession, but it is not strictly prohibited (haram).
Some scholars, such as Ibn Hazm, based on the absence of a strong prohibition, have said that it is permissible, though it is better to avoid (khilaf al-awla).