The World Federation One Stop Fiqh

Ruling 1453

If someone inadvertently raises his head from sajdah before the imam and goes back into sajdah, and then he realises that the imam had raised his head before he went into sajdah, his prayer is valid. However, if this happens in both sajdahs, then based on obligatory precaution, his prayer is invalid.