Some Christians have asked me, how did your Prophet salalllaahu ‘alayhi wa salam visit Masjid al Aqsa, if the Masjid did not exist at his time and was actually built after his time?
The Christian is assuming that a Masjid (سجود) is a structure or building with four walls and a roof. This is incorrect thinking, as a Masjid is a place where sujood (سجود), where prostration occurs. See the following quote taken from Lane’s Lexicon:
Therefore, as we can see, there is no need for a physical building to be present for an area to be considered a Masjid. Summarily, any place in which sujood/ prostration is done can be called a Masjid. This is also similar to the word Church (ἐκκλησίαν), which merely means the place of an “assembly or congregation”, and not particularly four walls, a roof and a bell tower. The individual who brings forward such an argument would therefore have to be greatly ignorant of Islam, and is merely seeking to conjure a straw man argument (a fallacious argument) by attempting to present an anachronistic error in Islamic teachings.
 – Arabic-English Lexicon by Edward William Lane (London: Willams & Norgate 1863), “سجود”, page 1308.
 – Strong’s Greek Lexicon, Reference #1577.
and Allaah knows best.