As discussed in an article by Uri Rubin called "The Ka'ba: Aspects of its Ritual Functions and Position in Pre-Islamic and Early Islamic Times," before Islam this was probably an enclosure for sacred livestock which could be sacrificed to one of the gods whose idols stood there. The sources suggest that the meat from the sacrifice was either laid upon stones or divided and eaten by the worshippers.
In Islam, the Hijr is believe to be the burial place of Ishmael, and perhaps other prophets, as well. It is among the most sacred spots in the Ka'aba complex, and used for oaths. I don't know about today, but there's also evidence that medieval Muslims believe the Hijr housed the spirits of the righteous dead.
Rubin's article was originally published in 1986 in Jerusalem Studies in Arabic and Islam. Now read about Eid al-Adha and considered the possibilies of historical continuity, one of my favorite things to talk about.