Since Muhammad claimed that his new religion was a continuation of the God of the Jews and Christians, he initially performed the Qibla change in Mecca and commanded his followers to pray facing Bait al-Muqaddas (Jerusalem) instead of the Kaaba. Upon reaching Medina, Muhammad further adopted many Jewish laws to please the Jews. However, he soon faced complete failure, as the Jews did not accept his claim of prophethood and instead labeled him a false prophet.

Thus began the enmity with the Jews, leading to the abrogation of Bait al-Muqaddas (in Jerusalem) as the Qibla, reinstating the Kaaba (in Mecca) as the Qibla.

People then perceived that Muhammad was angered by the Jews' refusal to accept him as a prophet, and in retaliation, he changed the Qibla. In response to this criticism, Muhammad called these critics "fools" in the Quran. The Quran mentions it as follows:

Surah Al-Baqarah, Ayat 143 to 146:

The foolish among the people will say, "What has turned them away from their Qibla, which they used to face?" ... We only appointed the Qibla which you used to face to see who would follow the Messenger and who would turn back on his heels.

Consequently, people (including Muslims) began to question what kind of God this was and what kind of wisdom it was that first directed them to face the Kaaba, then changed the Qibla to Jerusalem, and then, after a year and a half, due to the Jews' hostility, decided to change it back to the Kaaba.

It was impossible for the author of the Quran (i.e., Muhammad) to adequately answer this objection. Therefore, to silence these critics, Muhammad addressed them in the Quran as "fools." He then presented the excuse that Allah wanted to see who would turn back on his heels.

This is an extremely strange excuse, implying that Allah changed the Qibla twice just to see some people turn back. The most interesting point is that history does not record even a single person who turned away from Islam due to the Qibla change.

Thus, the question remains for Muslims: if not a single person was to turn away from Islam because of the Qibla change, what was the need for Allah to change the Qibla twice? It is clear that Muhammad used Allah's name to express his personal enmity towards the Jews.

The background story:

The Jews of Medina gave Muhammad the opportunity to show them the "Miracle of Fire" as proof of his prophethood. It was an established way of proving the prophethood as has been confirmed by the Quran too. However, Muhammad (and his Allah) failed in showing any miracle, and they made an excused for it. 

Quran 3:183:

They (the Jews) said: "Allah took our promise not to believe in any messenger unless He showed us a sacrifice consumed by Fire (From heaven)." Say: "There came to you messengers before me, with clear Signs and even with what ye ask for: why then did ye slay them, if ye speak the truth?"

Obviously, the Jews didn't accept this Quranic excuse as even if it was true, still they were not responsible for the crimes of their forefathers. 

As a result, not even 10 Jews accepted Muhammad as a prophet, which made him furious:

Sahih Bukhari, 3941:

عَنْ أَبِي هُرَيْرَةَ، عَنِ النَّبِيِّ صلى الله عليه وسلم قَالَ ‏ "‏ لَوْ آمَنَ بِي عَشَرَةٌ مِنَ الْيَهُودِ لآمَنَ بِي الْيَهُودُ

Narrated Abu Huraira: The Prophet said, "Had only ten Jews believe me, all the Jews would definitely have believed me."

But the Jews of Medina still refused to accept him as a true prophet, and that was the point where Muhammad's enmity and hatred started against the Jews:

  • First of all, Muhammad changed the Qibla once again from Bait-ul-Muqqadas to Ka'ba in Mecca. 
  • Then he started openly threatening the Jews to accept Islam, otherwise, they would be expelled from Medina, and he would snatch away all of their lands by force. 

Sahih Bukhari, 3167:

Narrated Abu Huraira: While we were in the Mosque, the Prophet (ﷺ) came out and said, "Let us go to the Jews" We went out till we reached Bait-ul-Midras. He said to them, "If you embrace Islam, you will be safe. You should know that the earth belongs to Allah and His Apostle (only), and I want to expel you from this land. So, if anyone amongst you owns some property, he is permitted to sell it, otherwise you should know that the Earth belongs to Allah and His Apostle."

This is the whole story behind the change of Qibla from Jewish Jerusalem to Meccan Kaaba.