To be able to play Minetest in a browser we have to follow these steps:
1) You need compiler, special one, which transcompile C/C++ to asm.js or webassembly, which are executed by JS engine, both very similar, except webassembly is binary format and newer, so recommended for new projects. Both formats are very fast so do not worry about game speed, work almost like native C speed.
Compiler is named: Emscripten, https://emscripten.org/
It is free and open source.
2) You need to port all OpenGL code to WebGl, I have heard there are some tools to automate such process, but never seen it in action.
3) Port all system calls to calls available in emscripten and/or browser itself.
3a) You do not have filesystem access in browser, so you have to use emulated virtual filesystem, Emscripten compiler has support and tools for that.
3b) All network connections have to be ported to use WebSockets, which mean work on both sides: client and server.
There is way to use websocket binary format, so only need to to add additional layer for websocket and send exactly same frames as in native Minetest.
Websockets are not compatible with normal sockets, so not possible (not easy) to connect to other servers.
4) You need to make some changes to main loop of the game.
In JS it is not possible to do infinite loops, well possible but problematic and impractical , such script will for sure be stopped by browser to avoid problems.
So such loop needs to be redone using events, for such purpose use setInterval(), setTimeout(), or even better requestAnimationFrame()