The Messenger of Allah (ﷺ) as saying: I forbade you to visit graves, but you may now visit them, for in visiting them there is a reminder (of death).
Sunan Abi Dawud Book 21, Hadith 147