Sahih al-Bukhari 399
حَدَّثَنَا عَبْدُ اللَّهِ بْنُ رَجَاءٍ قَالَ حَدَّثَنَا إِسْرَائِيلُ عَنْ أَبِي إِسْحَاقَ عَنِ الْبَرَاءِ بْنِ عَازِبٍ ـ رضى الله عنهما ـ قَالَ كَانَ رَسُولُ اللَّهِ صلى الله عليه وسلم صَلَّى نَحْوَ بَيْتِ الْمَقْدِسِ سِتَّةَ عَشَرَ أَوْ سَبْعَةَ عَشَرَ شَهْرًا وَكَانَ رَسُولُ اللَّهِ صلى الله عليه وسلم يُحِبُّ أَنْ يُوَجَّهَ إِلَى الْكَعْبَةِ فَأَنْزَلَ اللَّهُ {قَدْ نَرَى تَقَلُّبَ وَجْهِكَ فِي السَّمَاءِ} فَتَوَجَّهَ نَحْوَ الْكَعْبَةِ وَقَالَ السُّفَهَاءُ مِنَ النَّاسِ ـ وَهُمُ الْيَهُودُ ـ مَا وَلاَّهُمْ عَنْ قِبْلَتِهِمُ الَّتِي كَانُوا عَلَيْهَا {قُلْ لِلَّهِ الْمَشْرِقُ وَالْمَغْرِبُ يَهْدِي مَنْ يَشَاءُ إِلَى صِرَاطٍ مُسْتَقِيمٍ} فَصَلَّى مَعَ النَّبِيِّ صلى الله عليه وسلم رَجُلٌ ثُمَّ خَرَجَ بَعْدَ مَا صَلَّى فَمَرَّ عَلَى قَوْمٍ مِنَ الأَنْصَارِ فِي صَلاَةِ الْعَصْرِ نَحْوَ بَيْتِ الْمَقْدِسِ فَقَالَ هُوَ يَشْهَدُ أَنَّهُ صَلَّى مَعَ رَسُولِ اللَّهِ صلى الله عليه وسلم وَأَنَّهُ تَوَجَّهَ نَحْوَ الْكَعْبَةِ. فَتَحَرَّفَ الْقَوْمُ حَتَّى تَوَجَّهُوا نَحْوَ الْكَعْبَةِ.
Al-Barāʾ ibn ʿĀzib narrated that the Messenger of Allāh (saw) prayed facing Bait al-Maqdis for a period of 16 or 17 months, longing to face towards the Kaʿbah. So Allāh revealed the verse, ‘Verily, We see you turning your face often to heaven.’ (Sūrat al Baqarah, 2:145). So, he turned towards the Kaʿbah. The foolish among those people, the Jews, said: ‘What has turned them away from their Qiblah which they followed?’ Say, ‘To Allāh belong the East and the West. He guides whomsoever He pleases to the right path.’ (Sūrat al-Baqarah, 2:143). A man prayed with the Prophet (saw) and went out after he had prayed. He passed by some of the Anṣār who were praying ʿAṣr facing Bait al-Maqdis. He testified that he had prayed with the Messenger of Allāh (saw) and that he had turned his face towards the Kaʿbah. Subsequently, those people turned so that they faced towards the Kaʿbah.
Translation: Ahmadiyya Muslim Jamaat
Book 31: [During the obligatory Salat (prayers)] one should face the Qiblah (Kabah at Makkah) wherever one may be