After they die, the two witnesses are caught up to heaven (Revelation 11:12). As James Jordan points out in his lectures on Revelation, this is not the first time someone is caught up to heaven.
Enoch was, so was Elijah. Then Jesus, then the witnesses.
Each is a preacher of righteousness in a world of idolatry and evil. Enoch warns about a coming judgment (Jude 14-15), Elijah preaches against the house of Ahab (1 Kings 17-22), Jesus warns of the destruction of the temple (Matthew 24-25), and the two witnesses breathe out fire in the city (Revelation 11:5).
Jordan points out that there is a progression here: Enoch’s ascension was apparently without witnesses; Elisha alone saw Elijah caught up to heaven; the apostles watched Jesus disappear behind a cloud; but the ascension of the two witnesses is a public event: “their enemies beheld them” (11:12).
Jesus’ vindication is visible only to a few, but the vindication of the church is public. Jesus whispers, but His witnesses shout from housetops.