Visiting the Graves

Visiting the graves is recommended. The Messenger of Allah (S) said:

"I had prohibited you from visiting the graves, (now), visit them, since this reminds you of the Hereafter." [Muslim]

When visiting the graves, the Muslim should say what the Prophet (S) used to say when visiting Al-Baqi' (the graveyard of Al-Madinah):

"Peace be upon you, dwellers of these graves of the Muslims and the believers. We will join you when Allah wills. You are our predecessors and we will be your followers. We ask Allah's forgiveness for us and for you. O Allah, forgive them and have mercy on them." [Muslim]

Women are prohibited to frequently visit the graves. The Messenger of Allah (S) said:

"Allah's curse be upon the women that (frequently) visit the graves and illuminate them." [At-Tirmidhi and Al-Hakim]

It is permissible for women to infrequently visit the graves. This is based on the saying of Aishah (R) when she was asked about it: "Yes, the Messenger of Allah (S) had prohibited visiting of the graves, later, he permitted it." [Al-Hakim, Al-Baihaqi]