Mosques are oriented toward Mecca....it would be natural, and merely polite in any house of worship (term used loosely) regardless of faith, to face the front of the building. Imagine an imam at a Christian state funeral in any western nation turning toward the back or side of the church so he could pray toward Mecca. It would have been rude for the Pope to face any other direction.
The Pope was praying towards Jerusalem and the muslims took advantage and mislead people by ommitting the fact that between the Pope and Mecca lies Jerusalem. Check out a map of the middle eas and you'll see what I'm saying is a fact.