According to the hadith, the Ka'aba in Mecca was a center of idol-worship, with the Ka'aba housing 360 idols:



Sahih Bukhari 3:43:658 Narrated 'Abdullah bin Masud: The Prophet entered Mecca and (at that time) there were three hundred-and-sixty idols around the Ka’aba. He started stabbing the idols with a stick he had in his hand and reciting: "Truth (Islam) has come and Falsehood (disbelief) has vanished."

The Prophet Muhammad discarded the 360 idols but retained for Islam, the Ka’aba with its Black Stone, justifying it with the claim that Abraham and Ishmael originally constructed it. However, there is no historical or archaeological evidence for the existence of the Ka’aba beyond a few hundred years before Muhammad's lifetime. In fact, the Quran contradict this connection between Abraham, Ishmael and the Ka’aba.

The Quran says Abraham built it:



Quran 2:125 Remember We made the House a place of assembly for men and a place of safety; and take ye the station of Abraham as a place of prayer; and We covenanted with Abraham and Isma'il, that they should sanctify My House for those who compass it round, or use it as a retreat, or bow, or prostrate themselves (therein in prayer).

One hadith claims Muhammad says it was built 40 years prior to the Temple at Jerusalem:



Sahih Bukhari 4:55:636 Narrated Abu Dhaar: I said, "O Allah's Apostle! Which mosque was built first?" He replied, "Al-Masjid-ul-Haram." I asked, "Which (was built) next?" He replied, "Al-Masjid-ul-Aqs-a (i.e. Jerusalem)." I asked, "What was the period in between them? He replied, forty years.

The Temple at Jerusalem was built by Solomon around 958-951 BC. This implies that if Muhammad were to be believed, the Ka’aba must have been built approximately 998-991 BC. But Abraham is alleged to have lived around 2000 BC so both Abraham and Ishmael would have been dead by then.

The traditions of the hadith and the Quran are mutually contradictory and do not align with other traditions about Abraham and Ishmael.

Rather than being the creation of Abraham, Egyptian Professor and authority on Arabic literature, Dr. Taha Husayn, said the following:

[1]

The case for this episode is very obvious because it is of recent date and came into vogue just before the rise of Islam. Islam exploited it for religious reasons.

Also, according to a sahih hadith of Bukhari, Muhammad even considered dismantling it:



Sahih Bukhari 1:3:128 Narrated Aswad: Ibn Az-Zubair said to me, "Aisha used to tell you secretly a number of things. What did she tell you about the Ka'ba?" I replied, "She told me that once the Prophet said, 'O 'Aisha! Had not your people been still close to the pre-Islamic period of ignorance (infidelity)! I would have dismantled the Ka'ba and would have made two doors in it; one for entrance and the other for exit." Later on Ibn Az-Zubair did the same.

Worship at the Ka’aba and the kissing of the Black Stone are according to the Islamic tradition one of many practices adopted from the 7th century paganism of the Meccans and repackaged within monotheistic Islam.