This is a continuation of the previous verse.
And they heard a loud VOICE from HEAVEN saying, "COME UP HERE."
This confims the two witnesses are of God (not false teachers) because only God's own people are invited into heaven. This parallels the request to John in Revelation 4:1.
And they went up into HEAVEN in the cloud,
Note, it is 'the cloud' not 'a cloud'. There may be a special "God's cloud" which not only transports Jesus (Acts 1:9) and witnesses around but also contains the GLORY of God (Exodus 40:34-38).
and their enemies beheld them.
'BEHELD' is probably better translated 'STARED TRANSFIXED'. This is not a twinkling-of-an-eye exit (1 Corinthians 15:52). It is a slow deliberate departure. Most likely 'their enemies' were watching them closely to see what the two witnesses were going to do next. Their departure may have been a relief but even as believers are exhorted to be watchful, Luke 21:34-36, the enemies probably wonder if the two witnesses are going to return. Interestingly, they probably do with their Commander in the lead, Revelation 19:14.