The two witnesses in Revelation had invited much speculation over the years. Some have identified them as Moses and Elijah, some as the church and Israel, and many more views besides.
While some ambiguity may exist in the best of interepretations, I think the book of Revelation itself provides solid evidence for taking the witnesses as representative of the whole church.
John’s Prophetic Witness
Revelation 10 and 11 form a unit in Revelation that aims to show how both John and the church receive a prophetic and testifying role. As Jesus is the faithful witness (Rev 1:5; 3:14), so John and (as I will argue) the church become faithful witnesses like the Lord. The first stage of receiving that prophetic witness involves John.
John receives the little scroll from the angel in Revelation 10. This scroll likely should be associated with the scroll that the Lamb received (Rev 5) and unsealed (Rev 6–8). That seal reveals God’s redemptive and punitive purpose for the world. Here, in Revelation 10, John takes and devours this message like Ezekiel had before him (Rev 10:10; Ezek 3:3).
By devouring it, he absorbs the word of God in his new, prophetic role. As heaven declares to him, “You must again prophesy about many peoples and nations and languages and kings” (Rev 10:11 ESV).
The Church’s Prophetic Witness
In Revelation 11, the same mission will be handed off from the apostle to the church who are represented by the two witnesses. The witnesses are called lampstands (Rev 11:4), a term which Revelation 1:20 has already defined as the church and which Zechariah 4 defines as the temple of God.
Since Revelation 11 draws on Zechariah 4 for its imagery, the temple connection here for the people of God seems entirely appropriate to designate the church in which God’s Spirit dwells (see also John 2:19–21).
The two witnesses are two prophets (Rev 11:10) who prophesy (11:3, 6) until they have finished their testimony (11:7). As Jesus before them, they become faithful witnesses to the world until their work is done.
More could be said on the details here, but since Revelation calls for the church to become faithful witnesses like Jesus, since lampstands represent churches (Rev 1:20), and since Zechariah 4 identifies its lamptstand as the temple, then it follows that the two witnesses portray the church in its prophetic witness on earth.