The correct opinion is that of the majority of the Companions, for following the Prophet ﷺ is realized by obeying his commands and by imitating his deeds—doing what he did in the very way he did it. Thus, when he performed an act of worship in a specific location, worshipping there constitutes true emulation, just as one purposely goes to the sacred precincts and the mosques. But if he stopped somewhere merely by coincidence—because the time to halt happened to occur there or for some similar reason—and it is known that he did not deliberately choose that spot, then for us to single out that place is not an act of following him, for “actions are judged by their intentions.”
Some later scholars, however, regarded visiting such places as recommended. A number of authors from our school and others, in their manuals of pilgrimage rites, listed these mosques, named the sites, and encouraged visiting them. Imām Aḥmad permitted visiting those for which a sound report exists, on the condition that they are not turned into an “Eid”—that is, people do not make a point of journeying to them and gathering there at a fixed time. He likened this to allowing women to pray in the mosques in congregation—even though their homes are better for them—unless they display their adornment. In this way he reconciled the various traditions and cited the ḥadīth of Ibn Umm Maktūm as evidence.
A similar proof is the report recorded by both al-Bukhārī and Muslim from ʿItbān ibn Mālik, who said: “I used to lead my clan, Banū Sālim, in prayer. I went to the Prophet ﷺ and said, ‘My sight has become weak, and the floods block the way between me and my people’s mosque. I would be pleased if you came and prayed in a spot in my house so that I could designate it as a mosque.’ He replied, ‘I shall do so, God willing.’ The next morning, after the day had grown bright, the Messenger of Allah ﷺ arrived with Abū Bakr. The Prophet ﷺ asked permission to enter, and I granted it. He did not sit down before asking, ‘Where in your house would you like me to pray?’ I pointed out to him the place I preferred…"