This option is available in System Preferences, in the General preferences.
It is also possible to use the defaults command to set the menubar’s behavior. Here’s how you can set the menubar to be hidden and unhidden using defaults:
defaults write NSGlobalDomain _HIHideMenuBar -bool true
defaults write NSGlobalDomain _HIHideMenuBar -bool false
Once run, logout and log back in to see the change in behavior. Alternatively, you can run the following command as the logged-in user to restart Finder and show the changes: