Praise be to Allaah.
The correct view is that it is not allowed for women to visit graves, because of the hadeeth mentioned. It was narrated that the Prophet (peace and blessings of Allaah be upon him) cursed women who visit graves. Women should stop visiting graves. The woman who visited a grave out of ignorance (of this ruling) is not to blame, but she should not do it again. If she does so, she has to repent and seek forgiveness, and repentance cancels out whatever came before. Visiting graves is only for men. The Prophet (peace and blessings of Allaah be upon him) said: “Visit graves, for they will remind you of the Hereafter.” At the beginning of Islam, visiting graves was not allowed for men and women alike, because the Muslims were new in Islam and came from a background where grave-worship and attachment to the dead were widespread. So they were forbidden to visit graves as a preventative measure, to avoid evil and prevent shirk. But once Islam was well-established and they understood Islam, Allaah prescribed visiting the graves because of the lessons and reminders of death and the Hereafter involved in that, and so that they could make du’aa’ for the deceased and pray for mercy for them. Then Allaah forbade woman to do that – according to the most correct of the two scholarly opinions – because they may present a temptation to men and even to themselves, and because they have little patience and they get too upset. So by His mercy and kindness towards them, Allaah forbade them to visit graves. This is also a form of kindness towards the men, because if they were all to gather at the grave, this might cause fitnah. So by His mercy, Allaah forbade women to visit graves.
But with regard to the prayer (women praying the funeral prayer), there is nothing wrong with that. Women may join the funeral prayer. The prohibition applies only to visiting the graves. Women should not visit graves according to the more correct of the two scholarly opinions, because of the ahaadeeth which indicate that that is forbidden. She does not have to offer any kafaarah, all she has to do is repent.