The Kaaba pre-dates Islam as the site of pilgrimages. Legend aside, the first mosque around the Kaaba was built in the late 7th century and has undergone several re-buildings and renovations following various instances of destruction, by force or by fire. It was only in the late 1930s and early 1940s that the Grand Mosque took on grandiose stature--whether to glorify the House of Saud (Saudi Arabia's monarchy), which considers itself the guardian of the Grand Mosque, or to glorify God is, as always with religious shrines closely associated with their patrons, open to question.
The monumentally marbled dimensions of the Grand Mosque (a 7-acre expanse that can accommodate 1 million worshipers at one time and whose elevators can transport 100,000 people an hour) were designed and built by the Saudi Bin Laden Group in the early 1950s. The Bin laden Group was headed by Osama bin Laden's father. The renovation took 20 years and, along with the renovation of the Prophet's Mosque in Medina, cost $18 billion.