Compare these 2 structures carefully.
سَجَدُوا — ‘they (men) prostrated’
The doer is carried by the attached pronoun in the verb; no separate noun subject follows.
سَجَدَ الْمُسْلِمُونَ — ‘the Muslims prostrated’
The explicit noun الْمُسْلِمُونَ follows as the nominative subject, so the preceding verb is the masculine-singular form سَجَدَ.