The World Federation One Stop Fiqh

Ruling 1408

If a person joins congregational prayers when the imam is in rukūʿ and he bows down to the extent that is required for rukūʿ but doubts whether or not he joined when the imam was in rukūʿ, in the event that his doubt arises after the completion of rukūʿ, his congregational prayer is valid; otherwise, he can either complete his prayer on his own or he can break his prayer in order to join the next rakʿah.