عَنْ أَنَسٍ رَضِيَ اللَّهُ عَنْهُ أَنَّ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَآلِهِ وَسَلَّمَ كَانَ يُصَلِّي نَحْوَ بَيْتِ الْمَقْدِسِ فَنَزَلَتْ {قَدْ نَرَى تَقَلُّبَ وَجْهِكَ فِي السَّمَاءِ فَلَنُوَلِّيَنَّكَ قِبْلَةً تَرْضَاهَا فَوَلِّ وَجْهَكَ شَطْرَ الْمَسْجِدِ الْحَرَامِ} فَمَرَّ رَجُلٌ مِنْ بَنِي سَلِمَةَ وَهُمْ رُكُوعٌ فِي صَلَاةِ الْفَجْرِ وَقَدْ صَلَّوْا رَكْعَةً فَنَادَى أَلَا إِنَّ الْقِبْلَةَ قَدْ حُوِّلَتْ أَلَا إِنَّ الْقِبْلَةَ قَدْ حُوِّلَتْ إِلَى الْكَعْبَةِ قَالَ فَمَالُوا كَمَا هُمْ نَحْوَ الْقِبْلَةِ
Syedna Anas (may Allah be pleased with him) narrates that the Noble Prophet (peace and blessings be upon him) used to pray facing towards Bayt al-Maqdis, then when this verse was revealed: {قَدْ نَرٰی تَقَلُّبَ وَجْہِکَ فِی السَّمَائِ فَلَنُوَلِّیَنَّکَ قِبْلَۃً تَرْضَاہَا فَوَلِّ وَجْہَکَ شَطْرَ الْمَسْجِدِ الْحَرَامِ} … "Indeed, We see the turning of your face towards the heaven; surely We shall turn you to a Qiblah which you shall like. So turn your face towards al-Masjid al-Haram." Then a man passed by the people of Banu Salamah while they were in the state of bowing in the Fajr prayer and had completed one rak'ah, the passerby called out: "Beware! The Qiblah has been changed, beware! The Qiblah has been changed and now the Ka'bah is the Qiblah." So they turned towards the Qiblah in that very state.