The World Federation One Stop Fiqh

Ruling 1028

If after one’s forehead touches the ground he remembers that he did not perform rukūʿ, it is necessary that he stands up and performs rukūʿ; and in case he remembers in the second sajdah, then based on obligatory precaution his prayer is invalid.