This refers to every message that came before Islam and to every person who believed in Allah and followed up this belief with righteous deeds.
And faith is always tied together with good deeds, because faith is what is held in the heart and deeds affirm it. It (faith) is not just a word that is said, rather it is essential to follow it up with good deeds.
Every time the word faith is mentioned in the Noble Qur’an, it is followed up with good deeds:
﴾إِنَّ الَّذِينَ آمَنُوا وَعَمِلُوا الصَّالِحَاتِ كَانَتْ لَهُمْ جَنَّاتُ الْفِرْدَوْسِ نُزُلًا﴿
“Indeed, those who believe and do righteous deeds – they will have the Gardens of Paradise for their pleasure,” [Surah Al-Kahf: 107] and
﴿وَالْعَصْرِ (١) إِنَّ الْإِنسَانَ لَفِي خُسْرٍ (٢) إِلَّا الَّذِينَ آمَنُوا وَعَمِلُوا الصَّالِحَاتِ وَتَوَاصَوْا بِالْحَقِّ
وَتَوَاصَوْا بِالصَّبْرِ (٣)﴾
“By time. Indeed, mankind is in loss. Except for those who believe and do righteous deeds and advise each other to truth and advise each other to patience.” [Surah Al-‘Asr: 1-3].