According to Islamic tradition, the history of Mecca goes back to Ibrahim (ابراهيم, Abraham) when he built the Kaaba with the help of his son Ismā’īl (اسماعيل, Ishmael), around 2000 BC. The inhabitants were stated to have fallen away from monotheism through the influence of the Amelkites. Historians state that the Kaaba later became the repository of 360 idols and tribal gods of all of Arabia’s nomadic tribes. Until the 7th century, Mecca’s most important god would remain to be Hubal, having been placed there by the ruling Quraysh tribe.
The harsh conditions of the Arabian peninsula usually meant a constant state of conflict between the tribes, but once a year they would declare a truce and converge upon Mecca in an annual pilgrimage. This journey was intended for religious reasons, to pay homage to the shrine, and to drink from the Well of Zamzam. However, it was also the time each year that disputes would be arbitrated, debts would be resolved, and trading would occur at Meccan fairs. These annual events gave the tribes a sense of common identity and made Mecca extremely important throughout the peninsula.
*Not sure how accurate or contested - ideas found in this are.