عَنِ الْبَرَاءِ بْنِ عَازِبٍ رَضِيَ اللَّهُ عَنْهُ قَالَ صَلَّى رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَآلِهِ وَسَلَّمَ نَحْوَ بَيْتِ الْمَقْدِسِ سِتَّةَ عَشَرَ شَهْرًا أَوْ سَبْعَةَ عَشَرَ شَهْرًا ثُمَّ وُجِّهَ إِلَى الْكَعْبَةِ وَكَانَ يُحِبُّ ذَلِكَ فَأَنْزَلَ اللَّهُ عَزَّ وَجَلَّ {قَدْ نَرَى تَقَلُّبَ وَجْهِكَ فِي السَّمَاءِ فَلَنُوَلِّيَنَّكَ قِبْلَةً تَرْضَاهَا فَوَلِّ وَجْهَكَ شَطْرَ الْمَسْجِدِ الْحَرَامِ} الْآيَةَ قَالَ فَمَرَّ رَجُلٌ صَلَّى مَعَ النَّبِيِّ صَلَّى اللَّهُ عَلَيْهِ وَآلِهِ وَسَلَّمَ الْعَصْرَ عَلَى قَوْمٍ مِنَ الْأَنْصَارِ وَهُمْ رُكُوعٌ فِي صَلَاةِ الْعَصْرِ نَحْوَ بَيْتِ الْمَقْدِسِ فَقَالَ هُوَ يَشْهَدُ أَنَّهُ صَلَّى مَعَ رَسُولِ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَآلِهِ وَسَلَّمَ وَأَنَّهُ قَدْ وُجِّهَ إِلَى الْكَعْبَةِ قَالَ فَانْحَرَفُوا وَهُمْ رُكُوعٌ فِي صَلَاةِ الْعَصْرِ
Sayyiduna Bara’ bin Azib (may Allah be pleased with him) narrates that the Noble Prophet (peace and blessings be upon him) prayed facing Bayt al-Maqdis for sixteen or seventeen months. Then he (peace and blessings be upon him) was directed towards the Ka‘bah, and this was also the qiblah he preferred. So Allah Almighty revealed this verse: {قَدْ نَرٰی تَقَلُّبَ وَجْہِکَ فِی السَّمَائِ فَلَنُوَلِّیَنَّکَ قِبْلَۃً تَرْضَاہَا فَوَلِّ وَجْہَکَ شَطْرَ الْمَسْجِدِ الْحَرَامِ} … “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.” A man who had performed the ‘Asr prayer with the Noble Prophet (peace and blessings be upon him) passed by a group of the Ansar while they were in the state of bowing (ruku‘). He said: “I bear witness that I have prayed with the Noble Prophet (peace and blessings be upon him) and he has been commanded to face the Ka‘bah.” So they turned towards the Ka‘bah at that very moment while they were in the state of bowing.