وَإِنْ سَمِعُوا وَهُمْ فِي الصَّلَاةِ آيَةَ سَجْدَةٍ مِنْ رَجُلٍ لَيْسَ مَعَهُمْ فِي الصَّلَاةِ: لَمْ يَسْجُدُوهَا فِي الصَّلَاةِ، وَسَجَدُوهَا بَعْدَ الصَّلَاةِ، فَإِنْ سَجَدُوهَا فِي الصَّلَاةِ: لَمْ تُجْزِئْهُمْ، وَلَمْ تَفْسُدْ صَلَاتُهُمْ.
Translation: If worshippers hear a prostration verse during prayer from a person who is not praying with them, they should not prostrate within the prayer but after it. If they do so during prayer, that prostration does not suffice, yet their prayer is not invalidated.
The reciter here is not part of the congregation; the resulting obligation is performed outside that prayer.