Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:2:144

We have certainly seen the turning of your face, ˹O Muhammad˺, toward the heaven, and We will surely turn you to a qiblah with which you will be pleased. So turn your face toward al-Masjid al-Haram. And wherever you ˹believers˺ are, turn your faces toward it ˹in prayer˺. Indeed, those who have been given the Scripture well know that it is the truth from their Lord. And Allah is not unaware of what they do.  

We have indeed (qad, ‘indeed’, is for affirmation) seen you turning your face about in the, direction of the, heaven, looking around for the Revelation and longing for the command to face the Ka‘ba: he ˹the Prophet˺ wished for this because it was the prayer-direction of Abraham and would be more conducive to the submission of the Arabs ˹to Islam˺; now We will surely turn you to a direction that shall satisfy you, that you will love. Turn your face, in prayer, towards the Sacred Mosque, that is, the Ka‘ba, and wherever you are (addressing the ˹Muslim˺ community) turn your faces, in prayer, towards it. Those who have been given the Scripture know that it, the change towards the Ka‘ba, is the, fixed, truth from their Lord, on account of the description in their Scripture of how the Prophet (s) would re-orient himself to it; God is not heedless of what you do, O believers, when you obey His command (alternatively, ta‘malūna, ‘you do’, can be read ya‘malūna, ‘they do’, in other words ˹it would be referring to˺ the Jews’ denial of the matter concerning the direction of prayer).
القرآن:٢:١٤٤

قَدْ نَرَىٰ تَقَلُّبَ وَجْهِكَ فِي السَّمَاءِ ۖ فَلَنُوَلِّيَنَّكَ قِبْلَةً تَرْضَاهَا ۚ فَوَلِّ وَجْهَكَ شَطْرَ الْمَسْجِدِ الْحَرَامِ ۚ وَحَيْثُ مَا كُنْتُمْ فَوَلُّوا وُجُوهَكُمْ شَطْرَهُ ۗ وَإِنَّ الَّذِينَ أُوتُوا الْكِتَابَ لَيَعْلَمُونَ أَنَّهُ الْحَقُّ مِنْ رَبِّهِمْ ۗ وَمَا اللَّهُ بِغَافِلٍ عَمَّا يَعْمَلُونَ  

{قد} للتحقيق {نرى تقلُّب} تصرف {وجهك في} جهة {السماء} متطلعا إلى الوحي ومتشوقا للأمر باستقبال الكعبة وكان يود ذلك لأنها قبلة إبراهيم ولأنه دعى إلى إسلام العرب {فلنولينك} نحولنك {قبلة ترضاها} تحبها {فولِّ وجهك} استقبل في الصلاة {شطر} نحو {المسجد الحرام} أي الكعبة {وحيثما كنتم} خطاب للأمة {فولُّوا وجوهكم} في الصلاة {شطره وإن الذين أوتوا الكتاب ليعلمون أنه} أي التولي إلى الكعبة {الحق} الثابت {من ربهم} لما في كتبهم من نعت النبي من أنه يتحول إليها {وما الله بغافل عما تعملون} بالتاء أيها المؤمنون من امتثال أمره وبالياء أي اليهود من إنكار أمر القبلة.