Visiting the graves of divine figures is an acceptable act in all Islamic Madhhabs, even in Wahhabism. However, Wahhabis believe that when a person dies, his case is closed and rewards of good deeds such as recitation of the Quran, helping the needy, etc. will not reach him/her. They believe visiting the graves is permissible if it reminds the visitors of Akhirah and that visitors can only cry for their own sins.
However, this is different from what Prophet Muhammad (PBUH) and Islamic teachings have demonstrated. The Prophet of Islam once said one who makes a pilgrimage to Mecca and then visits his tomb is similar to one who has met him during his lifetime. He also says one who makes a pilgrimage to Mecca and refrains from visiting his tomb has actually mistreated him.
According to verse 21 of Surah Al-Kahf, constructing mosques over the grave of divine figures is not only permissible but also recommended. In the verse, Allah Almighty says He reminded people of the story of the People of Kahf so as to reassure people about the Day of Resurrection. When people understood the status of the seven individuals, who had slept in a cave for some 300 years upon God’s will, these faithful persons slept again and passed away. A dispute erupted among people about what do to for them and finally, they decided to build a mosque over their grave.
This article was derived from remarks made by Ali Asghar Rezvani, a researcher on religions.