Linguistically, the masjid is the place of prostration. Religiously, it is everything that is built for the Muslims to offer the five prayers in congregation. It is also used to refer to that which is more general that this. Thus, it also includes that place that a person uses in his house(or has allocated) to offer the voluntary prayers in, or he uses it to perform the obligatory prayers when he is unable to offer them in the masjid where the people have established congregational prayer. From this is that which Al-Bukhari and others recorded from Jabir, may Allah be pleased with him, who said that the messenger of Allah sallahu alayhi was sallam said:
"I was given five (things) that no one was given before me. I was aided with Ar-Ru'b (fright cast into the hearts of enemies) for a month's distance (of travel), and the earth was made a Masjid (place of prayer) for me and a means of purification. So any man from my nation (the Muslims) whom the (time for) prayer catches, then let him offer the prayer...."
(Al-Bukhari no. 33 and Muslim no.521)