وَكَذَٰلِكَ جَعَلْنَٰكُمْ أُمَّةً وَسَطًا لِّتَكُونُوا۟ شُهَدَآءَ عَلَى ٱلنَّاسِ وَيَكُونَ ٱلرَّسُولُ عَلَيْكُمْ شَهِيدًا وَمَا جَعَلْنَا ٱلْقِبْلَةَ ٱلَّتِى كُنتَ عَلَيْهَآ إِلَّا لِنَعْلَمَ مَن يَتَّبِعُ ٱلرَّسُولَ مِمَّن يَنقَلِبُ عَلَىٰ عَقِبَيْهِ وَإِن كَانَتْ لَكَبِيرَةً إِلَّا عَلَى ٱلَّذِينَ هَدَى ٱللَّهُ وَمَا كَانَ ٱللَّهُ لِيُضِيعَ إِيمَٰنَكُمْ إِنَّ ٱللَّهَ بِٱلنَّاسِ لَرَءُوفٌ رَّحِيمٌ ١٤٣
And thus We have made you a median [i.e., just] community that you will be witnesses over the people and the Messenger will be a witness over you. And We did not make the qiblah which you used to face except that We might make evident who would follow the Messenger from who would turn back on his heels. And indeed, it is difficult except for those whom Allāh has guided. And never would Allāh have caused you to lose your faith [i.e., your previous prayers]. Indeed Allāh is, to the people, Kind and Merciful.
Explanation: Al-Mukhtasar
Just as I made a direction of prayer for you, I have chosen you to be a good, just and balanced nation from among all the communities: in your beliefs and your ways of worship and in your transactions, so that you will be witnesses for the prophets of Allah on the Day of Judgement, confirming that they delivered the messages Allah instructed them to deliver to their people; and so that the Prophet Muhammad (peace be upon him) will also witness that he delivered his message to you. Allah changed the direction of prayer that you used to face (Jerusalem) to demonstrate who was content with Allah’s decree, willingly doing as He instructed and following the Messenger; and to also demonstrate who turned away from his religion, following his own desires and not obeying Allah’s sacred law. The first change of prayer direction was difficult, except for those who Allah granted faith to and who were certain that whatever He decrees for His servants has far reaching wisdom and underlying reasons behind it. Allah will not make you lose your faith in Him, or your good actions, including the prayers you prayed before the change of prayer direction. Allah is kind and compassionate with people, not overburdening them, and they will not lose the reward for their actions.