1) A lesson for the visitor: It will help remind the believer of the Hereafter.
2) Seeking Allah’s forgiveness for the deceased
A person may visit the graves because of the following reasons:
Visiting the graves in order to call upon their occupants this is major shirk and takes the person out of Islam. Example: The visitor says, O so and so, I ask you to relieve me
Visiting the graves in order to call Allah by the gravesite: This is the act of innovation, in addition, the visitor may find himself in fitnah. For instance, if Allah answers his request, he may think it was due to the blessing of the person laying inside this grave.
Visiting the grave to call Allah by using occupant as Negotiator: This involves putting the grave occupant as an intermediary between him and Allah; this is unlawful and could become major shirk.
Visiting the grave in order to show your grief: Ibn Taymiyyah said anything that agitates the Malady is from Mourning, hence it is permissible.
Visiting the graves for remembrance of Hereafter and Observation: visits that are prescribed in Islam and are required for the purpose of making dua for the deceased, praying for mercy for them, remembering death and preparing oneself for the Hereafter are totally permissible. The Messenger of Allah (PBUH) said: "Visit the graves, for they remind you of the Hereafter." (Narrated by Mus_lim, 976)
Therefore, solely the final two eventualities fulfill the felony justifications for touring the graves, and each is recommended. Some of you might think about the visiting of Prophet’s (PBUH) grave is it permissible well organize a journey particularly for visiting the Prophet’s (PBUH) grave is prohibited, however, organizing a journey to visit his Masjid is legal. If a person is visiting the Masjid and moves from his grave and pays salam, it is also permissible.
It is permissible to elevate your hands when reciting the dua for the deceased, because of the hadith of Aisha (RA) who stated: “The Messenger of Allah (PBUH) went out one night, and I sent Bareerah to follow him and see where he went. She said, ‘He went towards Baqi Al Gharqad [graveyard], and he stood at the bottom of al-Baqi’ and raised his hands, then he went away.’ Bareerah came back to me and told me, and when morning came I asked him about it. I said, ‘O Messenger of Allah, where did you go out to last night? He said, ‘I was sent to the people of al-baqi, to pray for them.’
But you have to no longer face the grave when making dua for them; instead, you should face the route of the Kabah, because the Prophet (PBUH) has prohibited to prayer (salaah) facing graves, and dua is the coronary heart and soul of salaah. The Prophet (PBUH) said: “Dua is worship” then he recited the aayah (interpretation of the meaning): “And your Lord said: “Invoke Me [i.e. believe in My Oneness (Islamic Monotheism) and ask me for anything] I will respond to your (invocation).” [Ghaafir 40:60]
The Messenger of Allah (PBUH) forbade the Muslims to walk over the graves wearing shoes. It was narrated that ‘Uqbah Ibn Aamir (RA) said: “ the messenger of Allah (PBUH) said: ‘If I were to walk on hot coals or on a sword, or if I were to mend my shoes using my feet, that would be better for me than if I were to walk on the grave of a Muslim. And it makes no difference to me if I was to relieve myself in the midst of the graves or in the middle of the market-place [i.e., both are equally bad].’” (Narrated by Ibn Maajah, 1567)