It is narrated from Sayyiduna Ibn Umar (may Allah be pleased with them both) that the Messenger of Allah (peace and blessings be upon him) said: "The prayer of fear is that the imam stands and a group of the people with him, and they perform one prostration, while another group is between them and the enemy. Then those who prostrated with their leader turn away (without completing the prayer) and take the place of those who have not prayed, and those who have not prayed come forward and perform one prostration with their leader. Then their leader turns away, having completed his prayer, and each of the two groups performs one more prostration on its own for its prayer. And if the fear is more intense than that, then (they pray) on foot or riding. By 'prostration' is meant a rak'ah."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 13337