Sheikh `Abd al-Rahmân al-Barrâk
The act of visiting graves comes in two forms. The first of these is a lawful visit to remember the Hereafter and pray for the deceased. The Prophet (peace be upon him) used to visit the graveyard and pay salutations to the deceased and pray to Allah for them. He also commanded his Companions to do the same.
He taught them what to say upon making such a visit, like: “Peace be upon you, O people of this abode who are believers and Muslims. May Allah have mercy on the first of us and the last of us. We will, Allah willing, soon be joining you!”
The graves of the unbelievers may be visited only for remembering the Hereafter. We are not allowed to pray for them for forgiveness. Allah says: “It is not fitting for the Prophet and those who believe, that they should pray for forgiveness for pagans, even though they be of kin, after it is clear to them that they are companions of the Fire.” [Sûrah al-Tawbah: 113]
The second form that the visiting graves takes in indeed an innovation tainted by polytheism. This is where people visit the graves of the Prophets and other pious people seeking blessing or the fulfillment of their needs from the dead.
If a person visits these graves to ask the dead to help him, give him what he needs, or to sacrifice an animal to them, then this is a case of major polytheism. It is polytheism of a lesser degree when someone prays to Allah in front of these graves in a normal manner, touching the graves or whatever is built over their graves for blessings.
We should keep in mind that building structures of any kind over the graves is itself an unlawful innovation. The Prophet (peace be upon him) said about those who build structures over the graves that “they are the worst among creatures”.
The Prophet (peace be upon him) also said: “Some of the People before you used to take the graves of their prophets as mosques, but do not take graves as mosques. I forbid you to do that.”
There can be no doubt that visiting the graves to direct supplications towards the denizens of the graves or to seek help from them is polytheism of the same type that the pagans of Mecca were guilty of. They used to worship angels, prophets, and pious people.
Their worship took several forms. Sometimes it took place at the graves. at other times, they would use idols which they had manufactured to represent those pious people.
We have an obligation towards the Prophets and the pious people to love them and believe in their virtues, and to emulate them in their good conduct.
Polytheism existed at the time of Prophet Noah (peace be upon him) on account of his people's extreme devotion to their pious people. They made statues to honor them and placed these statues in their rooms. They used to offer vigils at their graves until they reached the stage of actually worshipping them.
Satan still uses this method to misguide people today, as we can regretfully see in some Muslim countries.
What we have to do is to follow the guidance of Prophet Muhammad (peace be upon him) and the guidance of his righteous Companions. That is, indeed, is the true path.
May Allah guide us all to what pleases Him.
And Allah knows best.
Source: Islam Today