He should ask one who knows. If he finds no one to ask, he should try his best to determine it. In such a case, his prayer will be valid, and he need not repeat it even though he discovers later on that he had faced in the wrong direction. If it is made clear to him while he is praying that he is facing the wrong direction, he need only turn in the proper direction without stopping his prayer. This is based on the following incident: Ibn ‘Umar reported that the people were praying the morning prayer in the Quba’ mosque when a person came to them and said, “Allah has revealed some of the Qur’an to the Prophet in which we have been ordered to face the Ka’bah, so face it.” They immediately turned their faces from Syria to the Ka’bah.” (Related by al-Bukhari and Muslim.)
If one prays according to what he determined and then wants to make another prayer, he should again try to determine the qiblah’s direction. If it turns out to be different from what he had determined earlier, he should pray in the new direction without repeating his earlier prayer.