Generally, visiting graves is mustahab (recommended) for men and permissible for women. Visiting the graves of saintly people, parents and close relatives is considered mandoob (desirable). It is permissible and possible for women to visit graves as long as they do not cry out, wail, behave hysterically and respect graves too much, which can cause mischief. This is because the Prophet advised a woman who was wailing at her child’s grave to endure; yet he did not forbid her to visit the grave. (Bukhari, Janaiz, 2, Ahkam II; Muslim, Janaiz, 15). In addition, it is narrated that Hazrat Aisha visited her brother’s, Abdurrahman b. Abi Bakr, grave. (Tirmidhi, Janaiz, 61).
The Prophet prohibited visiting graves during a period of time when belief in fate was not yet settled and traditions of the era of ignorance were still being practiced. However, later he permitted it. The following is stated in a hadith:
“I had prohibited visiting graves for you. From now on you can visit graves”. (Muslim, Janaiz, 106; Adahi, 37; Abu Dawud janaiz, 77; Ashriba, 7; Tirmidhi, Janaiz, 7; Nasai, Janaiz, 100; Ibn Majah, Janaiz, 47; Ahmad b. Hanbal, I, 147, 452, III, 38, 63, 237, 250, V, 35, 355, 357). Hadiths that state that the Prophet cursed on women who visited graves too often (Tirmidhi, Salat, 21; Janaiz, 61; Nasai, Janaiz, 104; Ibn Maja, Janaiz, 49) belong to the period of time when visiting graves were prohibited. Tirmidhi stated it clearly (Tirmidhi, Janaiz, 60). Hazrat Aisha and Ibn Abdilberr agreed on it.
According to the sound view of Hanafis, it is permissible for women to visit graves as long as they do not display extreme behaviors such as wailing and behaving hysterically. This is because the permission mentioned in hadiths applies to women too. (Tirmidhi, Janaiz, 60, 61; Ibn Abidin, Radd al-Mukhtar, Istanbul, 1984, II, 242).
It has been observed in the stream of history that graves were also visited to ask for help from the dead and even to worship them.
This is the reason why visiting the Prophet’s grave was prohibited in the early years of Islam. Jews and Christians made the graves of people, whom they considered saints, place of worship for themselves. In the Era of Ignorance, people used to prostrate before graves and worship idols. Idolatry started with respect and revering to eminent people’s graves and eventually, that respect turned into worshipping idols. The aim of Islam was to place the principle of tawhid (accepting Allah as the unique Creator and worshipping to Him only) in people’s hearts. Previously, Prophet Muhammad had prohibited visiting graves because he found it risky for this reason. However, when the creed of tawhid was settled in people’s hearts and well comprehended by Muslims, he permitted people to visit graves.
As a matter of fact, there are benefits in visiting graves both for the living and the dead. When the Messenger of Allah was on the expedition to Makkah, he visited his mother Amina’s grave and cried, and made the people around him cry too, and he permitted Muslims to visit graves. (Ibn Majah, Janaiz, 48; Nasai, Janaiz, 101; Muslim, Janaiz, 36; Abu Dawud, Janaiz, 77). That permission and also encouragement of visiting graves are available in well-known hadiths. (Ibn Majah, Janaiz, 47; Tirmidhi, Janaiz, 60).
Benefits of Visiting Graves
a) It reminds one of death and afterlife, and makes him draw a lesson from it for his afterlife. (Muslim, Janaiz, 108; Tirmidhi, Janaiz, 59; Ibn Majah, Janaiz 47-48; Ahmad b. Hanbal, Musnad, I, 145).
b) It directs one to asceticism and taqwa (God-Consciousness). It prevents over-ambitiousness for worldly life and committing harams. It directs one to commit good deeds. (Ibn Majah, Janaiz, 47).
c) Visiting graves of saintly people – especially that of our Prophet’s – refreshes one’s soul and helps to evoke supreme feelings in them. It is mandoob to travel to the graves of our Prophet and Allah’s saintly slaves in order to visit them. The Prophet states in a hadith: “Whoever visits me after I die, it is as if he visited me when I was alive.” (Mansur Ali Nasif, at-Taj, al-Jamiu’l Usul, II, 190).
d) Visiting graves helps the strengthening of one’s relations with his past, religious culture and history.
Benefits of Visiting Graves for the Dead
a) Graves of parents, other relatives and friends are visited especially in order to pray for the peace of their souls and for their salvation. The fact that thawabs gained from good deeds that are performed on behalf of the dead will reach to them is stated in hadiths and determined by the consensus of Islamic scholars. When visiting the dead, one prays for the peace of their souls, reads the Quran and thawabs gained from those good deeds are donated to them. It is thawab to plant a tree at one’s grave. There are hadiths stating that a tree planted at a grave will be a reason to ease the dead person’s agony. It is makrooh (abominable) to put a wreath on graves as Christians do.
This Quranic verse indicates the fact that prayers and supplication made for the sake of the dead people’s souls will be beneficial for them: “Our Lord! Forgive us, and our brethren who came before us into the Faith, and leave not, in our hearts, rancor (or sense of injury) against those who have believed.” (al-Hashr, 59:10). There are many hadiths on the issue (Ahmad b. Hanbal, Musnad, II, 509; VI, 252; Ibn Majah, Adab).
b) The dead hear the living ones: It is stated in the hadiths that those in graves hear the ones who speak while visiting them and respond to their salutations. As narrated by Abdullah b. Umar, the Prophet addressed the corpses of Quraish people lying on the ground after the battle of Badr: “Have you comprehended that the punishment the Lord promised to you was true?” Upon this, Hazrat Umar said to him: “O Messenger of Allah, are you addressing those emotionless corpses?” And the Messenger of Allah said: “You do not hear more than those do. But they cannot answer.” (Ahmad b. Hanbal, II, 121). On the issue, Hazrat Aisha narrated the following hadith: “Now that they have died, they will comprehend the reality better. As a matter of fact, Allah said: O by beloved prophet, you cannot make yourself heard by the dead”. However, the majority of the Islamic scholars opposed Hazrat Aisha on the issue and based their views on the narration by Abdullah b. Umar written above because it was in line with other narrations. (see: az-Zabidi, Tajrid-i Sarih, translation, Kamil Miras, Ankara, 1985, IV, 580).
collected from- http://www.questionsonislam.com/