Man Lā Yaḥḍuruh al-Faqīh
Hadith 11881196 - وَقَالَ زُرَارَةُ لِأَبِي جَعْفَرٍ عَلَيْهِ اَلسَّلاَمُ: رَجُلٌ دَخَلَ مَعَ قَوْمٍ فِي صَلاَتِهِمْ وَ هُوَ لاَ يَنْوِيهَا صَلاَةً وَ أَحْدَثَ إِمَامُهُمْ فَأَخَذَ بِيَدِ ذَلِكَ اَلرَّجُلِ فَقَدَّمَهُ فَصَلَّى بِهِمْ أَ تُجْزِيهِمْ صَلاَتُهُمْ بِصَلاَتِهِ وَ هُوَ لاَ يَنْوِيهَا صَلاَةً قَالَ «لاَ يَنْبَغِي لِلرَّجُلِ أَنْ يَدْخُلَ مَعَ قَوْمٍ فِي صَلاَتِهِمْ وَ هُوَ لاَ يَنْوِيهَا صَلاَةً بَلْ يَنْبَغِي لَهُ أَنْ يَنْوِيَهَا وَ إِنْ كَانَ قَدْ صَلَّى فَإِنَّ لَهُ صَلاَةً أُخْرَى وَ إِلاَّ فَلاَ يَدْخُلَنَّ مَعَهُمْ وَ قَدْ يُجْزِي عَنِ اَلْقَوْمِ صَلاَتُهُمْ وَ إِنْ لَمْ يَنْوِهَا.
Hadith.1196 – Zurarah asked Imam Muhammad ibn Ali Al-Baqir (as) about a man who joined a group in their prayer without intending it as his own prayer. Then, their Imam experienced an issue (e.g., impurity) and took the hand of that man and appointed him to lead the prayer.
Zurarah asked: "Does their prayer count if they complete it with him, even though he did not intend it as his own prayer?"
Imam (as) replied: "It is not appropriate for a man to join a group in their prayer without intending it as his own prayer. Rather, he should intend it as such, even if he has already prayed. This way, he will have another prayer counted. If not, he should not join them. Nevertheless, the prayer of the group may be valid even if he did not intend it as his own”.