If one is unable to prevent oneself from coughing or sneezing during prayer or if one is unable to continue praying without coughing or sneezing or if one coughs or sneezes during prayer accidentally and forgot to attempt to restrain oneself, is the prayer invalidated?
In the name of Allah, Most Compassionate, Most Merciful,
Sneezing in Salat does not invalidate the prayer as it is unintentional.
As far as coughing is concerned, it will invalidate the Salat if the cough was without a need and it created the sound of letters. In other words, if one was to cough due to being forced or no sound of letters was uttered, then ones Salat will not become invalid.
However, if one coughed without having a actual need for it, and it created the sound of letters, Salat will become invalid. (See: Tahtawi ala Maraqi al-Falah, P.324).
And Allah Knows Best
[Mufti] Muhammad ibn Adam
Leicester , UK