The news reached them during the prayer
The Messenger of Allah (Muhammad), may Allah bless him and grant him peace, prayed the afternoon prayer toward the Kaaba. A man who had prayed with him went out and passed by a group of the Ansar (the supporters in Madinah) praying toward Bayt al-Maqdis while they were bowing. He said: "I bear witness by Allah that I prayed with the Messenger of Allah (Muhammad), may Allah bless him and grant him peace, facing Makkah." That is, turning toward Makkah. So they turned as they were toward the Kaaba. They did not wait for another prayer; the command reached them and they followed it in their prayer.
English narration has not been recorded yet
