I. Frankel wrote:
Our Shul faces east, whereas Jerusalem is southeast from our city. Almost everyone faces east but for one or two people who face south-east. Is it more important to face a bit more in the right direction, or not to be different from (and maybe disrespectful to) the vast majority of the worshippers?
Dear I. Frankel:
During prayer one should face towards Israel; in Israel towards Jerusalem, and in Jerusalem towards the Holy of Holies on the Temple Mount.
However, if the entire congregation is facing the wrong direction - although they're 'out of line' - one shouldn't differ from them but rather should face the same way they do. So in your case where the synagogue and the congregation face east, one should stand with his body facing east along with the rest of the congregation. However, he should tilt his face southeast towards Jerusalem.
Likewise someone praying at the Western Wall today should turn his face somewhat to the left so that he will be facing the place of the Holy of Holies.
And don't forget to point your heart in the right direction.
- Shulchan Aruch Orach Chaim 94:1,2
- Mishnah Berurah 10