This Ngram suggests the phrase became popular during the 19th century.

The OED says of mecca:
A place regarded as supremely sacred or valuable, or where a faith, policy, truth, etc., originates. Also more generally: a place which attracts people of a particular group or with a particular interest; a resort of (also for) a certain group of people.
Their earliest is quotation from the The Southern Literary Messenger (1843):
Wander in thought with me o'er the Mecca of Protestants, and linger, for a moment, around the graves of Luther and Melancthon [sic].
I found an earlier example in A Collection of Voyages and Travels published 1704:

The generality of the Inhabitants these Islands are Heathens; but from Sanxil to Samboangan the People the Coast are Mahometans; more particularly in the Islands of Basilan and Xolo, which are as it were the Metropolis that Superstition and the Mecca of Archipelago; because the first of it is bury'd, there of whom the giddy Headed Casikes tell a thousand Fables.
This, like other early uses, is describing a place as a religious centre of activity for an unfamiliar people, and perhaps Mecca was used rather than Rome or the Vatican as it suggests, for the Christian writer and readers, a non-Christian otherness or unfamiliarity.
Later, usage spread to non-religious centres of activity or especially pilgrimage and congregation, such as from The Spirit of Times (1877):
This is the Mecca of hundreds who desire to regain shattered health, and to breathe the pure mountain air so invigorating to weak and consumptive invalids.
Or The Guardian (2006):
Yet even these achievements are topped in my estimation by a claim once made by this newspaper. "Ashton-under-Lyne," it proclaimed "is the Mecca of tripe-eaters." (Or possibly tripe-lovers; this was a long time ago.)