بسم الله الرحمن الرحيم
Shaykh Salih states: Performing prayer at graves and supplicating there is an innovation and a means to lead one to polytheism, even if Allah is being invoked alone. However if the inhabitant of the grave is invoked alongside Allah, this (in comparison to the first thing mentioned) is polytheism. The prohibition of praying at graves emanates from the Prophet -sallahu alayhi wa salaam- when he said, “Do not pray towards graves!” Collected by Muslim. Umar when he saw some people praying at the graves he said, “the graves, the graves” (in disapproval), and he -sallahu alayhi wa salaam- said, “do not take graves as places of worship.”
Places of worship are where Allah is invoked (alone) as a result it is known by way of this the forbidden nature of supplicating at graves unless the supplication is for the inhabitant of the grave (seeking) for him forgiveness, mercy, and firmness. This is what the sunnah has brought forth, as the buried stand in dire need of others supplicating for them.
Translated by Najeeb Al Anjelesi
Source: المنظار في بيان كثير من الأخطاء الشائعة