Aisha reported: The Messenger of Allah, peace be upon him, said during his illness from which he did not recover, “Allah has cursed the Jews and Christians who have taken the graves of their Prophets as places of worship.” She said, “If it were not for that, his grave would have been in an open place but it was feared that it would be taken as a mosque.”
[Sahih Muslim, Book 4, Number 1079]
عَنْ عَائِشَةَ قَالَتْ قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ فِي مَرَضِهِ الَّذِي لَمْ يَقُمْ مِنْهُ لَعَنَ اللَّهُ الْيَهُودَ وَالنَّصَارَى اتَّخَذُوا قُبُورَ أَنْبِيَائِهِمْ مَسَاجِدَ قَالَتْ فَلَوْلَا ذَاكَ أُبْرِزَ قَبْرُهُ غَيْرَ أَنَّهُ خُشِيَ أَنْ يُتَّخَذَ مَسْجِدًا
صحيح مسلم كِتَاب الْمَسَاجِدِ وَمَوَاضِعِ الصَّلَاة إن أولئك إذا كان فيهم الرجل الصالح فمات بنوا على قبره مسجدا