The Messenger of Allah ﷺ permitted visiting graves.In another narration, Abdullah bin Abu Mulayka reported that Ayesha came back one day from the cemetery. He said, "I asked her, 'Umm Muiminin, where have you come from?'She replied, 'From the grave of my brother Abd al-Rahman bin Abu Bakr.'I asked her, 'Did the Messenger of Allah ﷺ not forbid visiting graves?'She answered, 'Yes, he had forbidden it, then later he commanded that they be visited.'"
أن رسول الله ﷺ رخص في زيارة القبور. وفي رواية: عن عبد الله بن أبي مليكة، أن عائشة أقبلت ذات يوم من المقابر، فقلت لها يا أم المؤمنين من أين أقبلت؟ قالت: من قبر أخي عبد الرحمن بن أبي بكر، فقلت لها: أليس كان رسول الله ﷺ نهى عن زيارة القبور؟ قالت: نعم كان نهى، ثم أمر بزيارتها.
No references are available.
Ibn Majah (1570) narrated it from Ibrahim bin Saeed Jawhari, who said, Rawh narrated to us, who said, Bistam bin Muslim narrated to us, who said, I heard Abu Tayah say, I heard Ibn Abu Mulayka narrate from Ayesha, and he mentioned it. This chain is sahih, and its narrators are trustworthy, as Busiri said in Zawaid.The second narration was reported by Hakim (1/376), and from him Bayhaqi (4/78), by way of Bistam bin Muslim, from Abu Tayah Yazid bin Humayd, from Abdullah bin Abu Mulayka, and he mentioned it. Bayhaqi said, "Bistam alone narrated it." I say, Bistam is Ibn Muslim Basri, trustworthy. Ibn Main and others confirmed his reliability, and Hafiz said of him, "Trustworthy." So his being the sole narrator does not harm the narration.The detailed account of this story was narrated by Tirmidhi (1055) from Abdullah bin Abu Mulayka himself, who said, Abdul-Rahman bin Abu Bakr died at Hubshi. He said, so he was carried to Makkah and buried there. When Ayesha arrived, she came to the grave of Abdul-Rahman bin Abu Bakr and said,"We were like the two companions of Judayma for a long stretch of time, until it was said, they will never be split apart. But when we parted, it was as though I and he, for all the length of our long companionship, had never spent a single night together."Then she said, "By Allah, if I had been present with you, I would not have buried you anywhere but where you died, and if I had witnessed your death, I would not visit your grave now."Tirmidhi narrated it from Husayn bin Hurayth, who said, Isa bin Yunus narrated to us, from Ibn Jurayj, from Abdullah bin Abu Mulayka, and he mentioned it. Abdul-Razzaq (6535) also reported it from Ibn Jurayj, who said, I heard Ibn Abu Mulayka. Ayub followed him in narrating it, as found in Abdul-Razzaq (6539).His statement "Hubshi" refers to a mountain at the foot of Makkah, six miles from it.Her statement, "and if I had witnessed your death, I would not visit your grave now" is evidence for the disapproval of women visiting graves. Shaykh al-Islam said, "This indicates that visiting graves is not recommended for women the way it is recommended for men, for if it were so, it would have been recommended for her to visit his grave just as it is recommended for men to visit graves, whether or not she had witnessed the death." Majmu Fatawa (24/345).