Makkah’s first permanent houses were built around the Ka’bah and did not have doors as an indication to pilgrims that they were welcome to make themselves at home among a people who considered themselves privileged to host them — the living epitome of the Arab greeting ‘ahlan wa sahlan.’
Hospitality before Islam
Even in the pre-Islamic era, the people of Makkah were well-aware of their duties towards the Ka`bah and its pilgrims and their favored position as neighbors of the Ancient House. The chiefs of Makkah, the Quraysh, distributed the duties of providing protection, food and water to pilgrims within their clans to prevent infighting and ensure the peace and security required to enable pilgrims to come to Makkah every year.
Banu Shayba’ held the keys to the Ka`bah while the right to supply pilgrims with water was with Banu Hashim Ibn `Abd Manaf. This was no easy task as it involved drawing water from the wells around Makkah, loading it onto camels and filling leather cisterns and earthenware vessels in Al-Masjid al-Haraam.
Qusayy Ibn Kilab was the first to assume the right to provide food for pilgrims with contributions from the nobles of the Quraysh, saying:
“O men of Quraysh, you are neighbous of Allah’s House, the people of His House and the people of the Sanctuary; and in this season come to you Allah’s visitors, the pilgrims to His House. They are the guests of Ar-Rahmaan, and no guests have a claim on your generosity like His guests. So, provide them with food and drink in seasons of Hajj so that they may talk of your generosity.”
Thus, although the people of pre-Islamic times were hospitable and showed their famed generosity to pilgrims, their motive was often worldly gains: increasing trade and boosting their reputation.
Later, Banu Nawfal and Banu Hashim took on the task of providing food for the pilgrims.
The Prophet’s grandfather, Abd Al-Muttalib took on the responsibility of providing food and water to the pilgrims, at a time when Makkah was facing a drought during the Hajj season. ‘Abd Al-Muttalib saw a dream that led him to rediscover the well of Zamzam with his son Al-Harith, which made it easy to provide pilgrims with water — which is the source of water in Al-Masjid al-Haraam until today.
Hospitality in Islam
The flow of pilgrims to Makkah increased considerably after Islam and its residential areas continued to grow. It was common for pilgrims from all over the Muslim world to go for Hajj and settle in Makkah. These newcomers called mujaawiroon (neighbors) built their houses on slopes and hilltops, due to a shortage of land in the valley and the problem of seasonal flooding in those days.
Makkan houses had their own character, distinguished by their open spaces, compact floor plan, and latticework windows. The height of their buildings did not exceed two stories. Over centuries, travelers described them as: “built of black, smooth stones and also of white stones, but the upper parts are of teakwood and are several stories high, whitewashed and clean.” 
In the 12th century, Andalusian geographer Ibn Jubayr commented on the flat roofs of Makkah’s houses: “We passed the nights on the roof of the place where we stayed and sometimes the cold of the night air would fall on us and [we] would need a blanket to protect us from it.”
Joseph Pitts, an English convert who performed the pilgrimage in about 1684, wrote in an account of Makkah: “The inhabitants, especially men, do usually sleep on the tops of houses for the air or in the street before their doors…. As for my part, I usually lay open, without any bed covering, on the top of the house…”
Traditional houses in Makkah today continue to serve the pilgrims’ needs just like in pre-modern times. As Makkah had no hotels in the past, many Makkans provided accommodations for pilgrims during the Hajj season, renting out a room, a floor or even an entire house. When building a house, Makkans generally
thought in terms of a bi-functional structure, serving as both home and lodgings for pilgrims.
Expansion of Al-Masjid al-Haraam over the ages
The earliest projects to renovate and expand Al-Masjid al-Haraam to accommodate more pilgrims began during the time of ‘Umar ibn Al-Khattab, may Allah be pleased with him, when Makkah was hit by a major flood that damaged the Ka’bah and the Maqam of Ibrahim (the Station of Ibrahim). This spurred ‘Umar, may Allah be pleased with him, to acquire land and houses adjoining the area to accommodate pilgrims, and he added doors and lamps to its buildings.
‘Uthmaan ibn ‘Affaan, may Allaah be pleased with him, expanded the area further by buying some of the houses surrounding the mosque and demolishing them to increase the area of Al-Masjid Al-Ḥaraam. He built an arcade under which worshippers could be shaded — this was the first arcade added to Al-Masjid Al-Ḥaraam.
‘Abdullaah ibn Az-Zubayr may Allaah be pleased with them both, rebuilt the Ka‘bah according to its original dimensions after it caught fire after being hit by a catapult. He increased the height of the Ka‘bah by 10 cubits and made an entrance and an exit at floor level, which corresponded to the description given by the Prophet(PBUH)
Muslim rulers over the years took care to honor the Ka‘bah and its pilgrims. During the Caliphate of ‘Abd Al-Malik ibn Marwaan and other Umayyad caliphs, workers were appointed to work in the masjid and serve pilgrims. The Abbasid Caliph Abu Ja‘far Al-Mansoor expanded the mosque, tiled its floors with marble, built a wall around the Zamzam well to protect people from falling in it, and added another arcade to the mosque.
In the period of Al-Mahdi, the houses between the Ka‘bah and the Mas‘a (the area where pilgrims perform Sa’y) were demolished to connect the Ka’bah and the Mas’a, expanding the area of the mosque. His successor Al-Waathiq added copper lantern posts to ease performing Tawaaf at night.