A man arrived and announced, “Last night a passage of the Qur’an was revealed to the Messenger of Allah ﷺ, and he has been commanded to face the Kaʿbah—so turn toward it.” Their faces had been directed toward Syria, and they immediately turned round toward the Kaʿbah.
Muslim (1) records a similar report from Anas ibn Mālik.
In sum, when the order came down to shift the qiblah to the Kaʿbah—thereby abrogating the earlier ruling to pray toward Jerusalem—critics among the foolish, ignorant rabble began to object, saying, “What has turned them from the qiblah they were facing?” Yet the unbelievers from among the People of the Book already knew that the change was from Allah, for they found in their own scriptures the description of Muhammad ﷺ: that his migration would be to Madinah and that he would later be commanded to face the Kaʿbah. Allah says, “Those who were given the Scripture know well that it is the truth from their Lord” (al-Baqarah 2:144).
Nevertheless, Allah answered their question and their stubbornness, saying, “The foolish among the people will say, ‘What has turned them away from their qiblah which they used to face?’ Say, ‘To Allah belong the East and the West; He guides whom He wills to a straight path’” (al-Baqarah 2:142). In other words, He is the absolute Sovereign, the Disposer, the Judge whose decree none can overturn. He does whatever He wills with His creation and legislates as He pleases in His law. He guides whom He wills to a straight path and leads astray whom He wills from the right way, and in all of this His wisdom demands acceptance and submission.
He then said, “And thus We have made you a balanced nation so that you may be witnesses over mankind and the Messenger be a witness over you” (al-Baqarah 2:143)—that is, the choicest of communities. Just as We chose for you the best direction for your prayer and guided you to the qiblah of your forefather Abraham—after the direction that Moses and the messengers before him observed—so too have We made you the finest of nations, the quintessence of the world, the noblest of peoples, the most honored of both the earlier and later generations. On the Day of Resurrection you will testify against the other nations, for they will unanimously acknowledge your merit on that Day, as is established in Ṣaḥīḥ al-Bukhārī (6) in the marfūʿ report of Abū Saʿīd about Noah seeking the testimony of this ummah on the Day of Judgment. If Noah—despite the long interval between his time and theirs—will seek their testimony, then the later prophets will do so even more.
Thereafter the Almighty clarified His wisdom in sending punishment upon those who doubted and wavered at this event and in bestowing favor upon those who believed and complied, saying, “We did not appoint the qiblah you once faced except to know who would follow the Messenger …”