In the Sharḥ al- Asāṭīr, a commentary on the Samaritan midrashic chronology of the Patriarchs, of unknown date but probably composed in the tenth century C.E., it is claimed that Mecca was built by the sons of Nebaioth, the eldest son of Ishmael. Some time in the 5th century, the Kaaba was a place of worship for the deities of Arabia's pagan tribes. Mecca's most important pagan deity was Hubal, which had been placed there by the ruling Quraysh tribe and remained until the 7th century.
Mecca seen from Jabal al-Nour
In the 5th century, the Quraysh took control of Mecca, and became skilled merchants and traders. In the 6th century they joined the lucrative spice trade as well, since battles in other parts of the world were causing trade routes to divert from the dangerous sea routes to the more secure overland routes. The Byzantine Empire had previously controlled the Red Sea, but piracy had been on the increase. Another previous route that ran through the Persian Gulf via the Tigris and Euphrates rivers, was also being threatened by exploitations from the Sassanid Empire, as well as being disrupted by the Lakhmids, the Ghassanids, and the Roman–Persian Wars. Mecca's prominence as a trading center also surpassed the cities of Petra and Palmyra.
The Sassanids however did not always pose a threat to Mecca as in 575 CE they actually protected the Arabian city from invasion of the Kingdom of Axum, led by its Christian leader Abraha. The tribes of the southern Arabia, asked the Persian king Khosrau I for aid, in response to which he came south to Arabia with both foot-soldiers and a fleet of ships into Mecca. The Persian intervention prevented Christianity from spreading eastward into Arabia, and Mecca and the Islamic prophet Muhammad who was at the time a six-year-old boy in the Quraysh tribe "would not grow up under the cross."
By the middle of the 6th century, there were three major settlements in northern Arabia, all along the south-western coast that borders the Red Sea, in a habitable region between the sea and the great mountains to the east. Although the area around Mecca was completely barren, it was the wealthiest of the three settlements with abundant water via the renowned Zamzam Well and a position at the crossroads of major caravan routes.
The harsh conditions and terrain of the Arabian peninsula meant a near-constant state of conflict between the local tribes, but once a year they would declare a truce and converge upon Mecca in an annual pilgrimage. Up to the 7th century, this journey was intended for religious reasons by the pagan Arabs to pay homage to their shrine, and to drink from the Zamzam Well. 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 an important focus for the peninsula.
The Year of the Elephant is the name in Islamic history for the year approximately equating to 570 CE. According to Islamic tradition, it was in this year that Muhammad was born. The name is derived from an event said to have occurred at Mecca. According to early Islamic historians such as Ibn Ishaq, Abraha the Christian ruler of Yemen, which was subject to the Kingdom of Aksum of Ethiopia, built a great church at Sana'a known as al-Qullays in honor of the Aksumite king Negus. It gained widespread fame, even gaining the notice of the Byzantine Empire. Abraha attempted to divert the pilgrimage of Arab people from [Kaaba to al-Qullays and appointed a man named Muhammad ibn Khuza'i to Mecca and Tihamah as a king with a message that al-Qullays was both much better than other houses of worship and purer, having not been defiled by the housing of idols.
When Muhammad ibn Khuza'i got as far as the land of Kinana, the people of the lowland, knowing what he had come for, sent a man of Hudhayl called ʿUrwa bin Hayyad al-Milasi, who shot him with an arrow, killing him. His brother Qays who was with him fled to Abraha and told him the news, which increased his rage and fury and he swore to raid the Kinana tribe and destroy the temple. Ibn Ishaq further states that one of the men of the Quraysh tribe was angered by this, and going to Sana'a, slipped into the church at night and defiled it; it is widely assumed that they did so by defecating in it. Abraha marched upon the Kaaba with a large army, which included one or more war elephants, intending to demolish it. When news of the advance of Abraha's army came, the Arab tribes of the Quraysh, Banu Kinanah, Banu Khuza'a and Banu Hudhayl united in defense of the Kaaba. A man from the Himyarite Kingdom was sent by Abraha to advise them that Abraha only wished to demolish the Kaaba and if they resisted, they would be crushed.
Abdul Muttalib told the Meccans to seek refuge in the hills while he with some leading members of the Quraysh remained within the precincts of the Kaaba. Abraha sent a dispatch inviting Abdul-Muttalib to meet with Abraha and discuss matters. When Abdul-Muttalib left the meeting he was heard saying, "The Owner of this House is its Defender, and I am sure he will save it from the attack of the adversaries and will not dishonor the servants of His House." Abraha attacked Mecca However, the lead elephant, known as Mahmud, is said to have stopped at the boundary around Mecca and refused to enter. It has been theorized that an epidemic such as by smallpox could have caused such a failed invasion of Mecca. The reference to the story in Qur'an is rather short. According to the al-Fil sura, the next day, [as Abraha prepared to enter the city], a dark cloud of small birds sent by Allah appeared. The birds carried small rocks in their beaks, and bombarded the Ethiopian forces and smashed them like "eaten straw".
Camel caravans, said to have first been used by Muhammad's great-grandfather, were a major part of Mecca's bustling economy. Alliances were struck between the merchants in Mecca and the local nomadic tribes, who would bring goods – leather, livestock, and metals mined in the local mountains – to Mecca to be loaded on the caravans and carried to cities in Syria and Iraq. Historical accounts also provide some indication that goods from other continents may also have flowed through Mecca. Goods from Africa and the Far East passed through en route to Syria including spices, leather, medicine, cloth, and slaves; in return Mecca received money, weapons, cereals and wine, which in turn were distributed throughout Arabia.
The Meccans signed treaties with both the Byzantines and the Bedouins, and negotiated safe passages for caravans, giving them water and pasture rights. Mecca became the center of a loose confederation of client tribes, which included those of the Banu Tamim. Other regional powers such as the Abyssinian, Ghassan, and Lakhm were in decline leaving Meccan trade to be the primary binding force in Arabia in the late 6th century.
(source)