structural:reformatting
Ancient and mediaeval

The founding of Mombasa is associated with two rulers: Mwana Mkisi and Shehe Mvita. According to legend, Mwana Mkisi is the original ancestor of Mombasa's oldest lineages within Thenashara Taifa (or Twelve Nations). Families associated with the Twelve Nations are still considered the original inhabitants of the city. Mwana Mkisi was a queen from the pre-Islamic era, who founded Kongowea, the original urban settlement on Mombasa Island.

Significantly, the names of both the queen and the city have linguistic and spiritual connections with Central Africa. "Mkisi" is considered the personification of "ukisi", which means "the holy" in kiKongo. "Kongowea" can similarly be interpreted as the Swahili locative of "kongo", which denotes the essence of civilizational order in central Africa. These legends can be read as an acknowledgement of the Bantu -speaking origins of the Swahili people.

Shehe Mvitaff superseded the dynasty of Mwana Mkisi and established the first permanent stone mosque on Mombasa Island. Mombasa's oldest extant stone mosque, Mnara, was built c. 1300. Shehe Mvita is remembered as a Muslim of great learning and so is connected more directly with the present ideals of Swahili culture that people identify with Mombasa. The ancient history associated with Mwana Mkisi and Shehe Mvita and the founding of an urban settlement on Mombasa Island is still linked to present-day peoples living in Mombasa. The Thenashara Taifa (or Twelve Nations) Swahili lineages recount this ancient history today and are the keepers of local Swahili traditions.

Most of the early information on Mombasa comes from the writings of Portuguese chroniclers in the 16th century.

The famous Moroccan scholar and traveller Ibn Battuta (1304 – 1368/1369) visited the area during his travels to the Swahili Coast. He noted the city, although he stayed only one night. He wrote that the people of Mombasa were Shafi'i Muslims, religious people, trustworthy and righteous. Their mosques were made of wood, expertly built.

The exact founding date of the city is unknown, but it has a long history. Kenyan school history books place the founding of Mombasa as 900 A.D. It must have been already a prosperous trading town in the 12th century, as the Arab geographer al-Idrisi mentions it in 1151. The oldest stone mosque in Mombasa, Mnara, was built c. 1300. The Mandhry Mosque, built in 1570, has a minaret that contains a regionally specific ogee arch. This suggests that Swahili architecture was an indigenous African product rather than being adopted from non-African Muslims who brought stone architecture to the Swahili Coast.

During the pre-modern period, Mombasa was an important centre for the trade in spices, gold, and ivory. Its trade links reached as far as India and China. Oral historians today can still recount this period of local history. Indian history shows that there were trade links between Mombasa and Cholas of South India. Throughout the early modern period, Mombasa was a key node in the complex and far-reaching Indian Ocean trading networks. Its key exports were ivory, millet, sesamum and coconuts.

Ivory caravans remained a major source of economic prosperity. Mombasa became the major port city of pre-colonial Kenya in the Middle Ages and was used to trade with other African port cities, the Persian Empire, the Arabian Peninsula, India and China.

Sixteenth-century Portuguese voyager Duarte Barbosa wrote,

" is a place of great traffic and has a good harbour in which there are always moored small craft of many kinds and also great ships, both of which are bound from Sofala and others which come from Cambay and Melinde and others which sail to the island of Zanzibar."