Chapter 2: Surat Al-Baqarah (The Cow), verses 142-143

Translation:
The foolish will ask: ‘What has made them turn away from their qiblah Say: ‘The east and west are God’s. He guides whom He wills to the right path.’ We have made you a just nation, so that you may testify against mankind, and that your own Apostle may be a witness against you. We decreed your former qiblah only in order that We might know the Apostle’s true adherents and those who were to disown him. It was indeed a hard test, but not to those whom God has guided. And never would God make your faith fruitless. He is Compassionate and Merciful to men.
Tafsir
(Commentary):
The qiblah
is the direction in which Muslims face when they pray. This direction has to
do with the form, rather than the reality, of worship. A qiblah is
appointed so that prayer may assume an organized pattern. God can change it as
He pleases, for every direction faces Him. The direction that He lays down is
the one that we should face in our prayer, whatever direction it may be. Before
the coming of Islam people had prayed towards Jerusalem. This old qiblah had
come to be thought of as sacred and inviolable. In the second year after the
Prophet’s emigration to Medina, he was commanded to alter the direction of
prayer, and face Mecca instead of Jerusalem. Some people found this change
difficult to accept. How, they thought, could another place be the qiblah when
Jerusalem had held this position since time immemorial? The Jews used the change
of the qiblah as an excuse for spreading all sorts of rumours about the
Prophet. Previous prophets have always faced Jerusalem in their prayer, they
said. How is it that this prophet has gone against them? This goes to show that
the only purpose of his mission is to spite the Jews. Some poured scorn on
Muhammad’s claim to prophethood. He seems to be in two minds about his own
mission, they said. Sometimes he faces Jerusalem, sometimes Mecca. Others said:
“Well, if the Kabah in Mecca is the real qiblah then all the prayers
which Muslims have made towards Jerusalem have been wasted.”
These
were the sort of objections that Jews and hypocrites made. True believers, those
who were not caught up in the externals of religion, did not let such things
discountenance them. They realized that it is not the direction of prayer that
really matters, it is God’s commandment. God can lay down any qiblah, whenever
He likes. Whatever He prescribes should be followed. The commandment regarding
the change of qiblah was revealed seventeen months after the Prophet’s
emigration to Medina. The Prophet was praying along with a group of his
companions at the time. As soon as God’s commandment became clear, all of them
turned, as they were praying, from Jerusalem to Mecca—a 160 degree turn from
north-west to south.