Is Prayer Invalid If `Awrah Becomes Exposed Accidentally?
Question

What is the ruling on prayer if part of a woman’s body – such as her neck or hair or knee – becomes uncovered accidentally, and whilst praying she hastened to cover it again? Should she repeat the prayer, or what should she do?
Praise be to Allah.Importance of Covering the `Awrah in Prayer
Covering the `Awrah is a condition of prayer being valid  according to the majority of scholars (may Allah have mercy on them), in the case of both men and women. Please see the answer to question no. 1046 for the definition of a woman’s `Awrah in prayer.
The evidence for that includes the report narrated by `Aishah (may Allah be pleased with her), according to which the Prophet (blessings and peace of Allah be upon him) said: “Allah does not accept the prayer of a woman of childbearing age except with a headcover.” (Narrated by Abu Dawud and At-Tirmidhi; classed as autentic by Al-Albani in Sunan Abu Dawud)
Ibn `Abd Al-Barr (may Allah have mercy on him) said: Those who say that covering the `Awrah  is one of the obligatory duties of prayer quoted as evidence the consensus that the prayer of one who fails to put on his garment when he is able to cover himself with it, and prays naked, is invalid. He said: All of them unanimously agreed on this.” (End quote from Al-Mughni , 1/337)
Accidental Uncovering During Prayer
If someone prays covering his `Awrah, but part of it becomes uncovered accidentally, then he covers it immediately, his prayer is valid, whether the worshipper is a man or woman, and whether what is uncovered in the minor `Awrah or the private parts , and whether what is uncovered is a lot or a little.
It says in Kashshaf Al-Qina` (1/269): The prayer is not rendered invalid if a small part of the `Awrah becomes uncovered accidentally, or even if the small part that becomes uncovered remains so for a long time. Similarly, the prayer is not rendered invalid if a large part of the `Awrah becomes uncovered for a short time. So if the wind lifts the worshipper’s cover from his `Awrah, and uncovers of it that which cannot be pardoned if it remains uncovered for a long time because it is indecent, and even if what is uncovered is the entire `Awrah, but he covers it again quickly, without a great deal of movement, his prayer is not rendered invalid, because the uncovering was only brief. But if he needs to take hold of his garment and it involves a great deal of movement, his prayer is rendered invalid. (End quote)
Shaykh Ibn `Uthaymin (may Allah have mercy on him) said:
If a large part becomes uncovered but he covers it again within a short time, then his prayer is not rendered invalid. That can be imagined if the wind blows when he is bowing, and it lifts his garment, but he puts it back immediately. The apparent meaning of the author’s words may indicate that the prayer is rendered invalid, but the correct view is that it is not rendered invalid, because he covered it again quickly, and did not deliberately uncover it, and Allah, may He be exalted, says (interpretation of the meaning): {So fear Allah as much as you are able.} [At-Taghabun 64:16] ” (End quote from Ash-Sharh Al-Mumti`  2/75).
Based on that, your prayer is valid, so long as you have covered yourself again immediately, and you do not have to repeat it.
And Allah knows best.