The metaverse has transitioned from a science fiction term to a rapidly growing area of research and application, with potential uses in education, professional training, social events, and the virtual economy. However, despite this progress, a fully realized and functional metaverse is not yet available, and its development still requires a clear understanding and definition of the research directions to follow. Nonetheless, the metaverse topic does not start from scratch; it shares its foundations with Virtual Environments (VEs), which represent the Virtual Reality applications' core. In this paper, we built on top of the knowledge given by the history of the two topics to present a scoping review of the historical development of research in VEs and the metaverse from the 1990s to early 2024, analyzing 352 papers from the Scopus database. We aimed to offer a comprehensive understanding of how past research informs the present and future directions of the metaverse. Our findings revealed that the metaverse, while emerging as a distinct research area in recent years, is deeply rooted in the history of VEs, with many of its concepts and technologies deriving from earlier work in the field. We also identified new, underexplored trends within the metaverse research, proposing a future research agenda informed by the shared history of the two topics.