First reported on GitHub as an htop bug, the issue appears to run deeper than that, with freezes being reported by users of various other command line applications, such as the Nix package manager and zsh.
With htop, the issue manifests first as the Terminal freezing – with both the standard macOS Terminal and iTerm2 being affected. Next, Activity Monitor will stop displaying running apps. Then, the user will lose the ability to launch new applications or interact with the file system – so while the operating system doesn't quite crash yet, it is not functional anymore, to the point where it's not even possible to restart the computer through normal means.
While the thread in the htop GitHub appears to attribute the bug to APFS, the new file system in macOS High Sierra, some users on installations still using HFS+ have been seeing this issue happen.
The exact cause of this issue is not yet known, but it appears that resource-intensive operations, such as working with APFS volumes may cause the issue. One user was able to reproduce the issue by using htop while launching and destroying many processes in the background. Since htop is a status monitoring program, it could be possible that the issue involves system calls that applications such as htop could be working to collect information about other processes.
The good news is that multiple users have reported that this issue is not present in macOS 10.13.2 betas, but with the true cause of this bug still being unclear, it might be best to wait for the update to come out, if you're still on an older version of macOS.
Special thanks to Philo