The feature is called "immersive mode" and was first introduced in Android 4.4 KitKat.
For official method, there is no way to use this in all apps, and only the developers of the app may decide to implement it or not.
However, there are some 3rd-party apps that can force immersive mode in all apps:
- GMD Full Screen Immersive Mode (free, Pro version with IAP). Follow the instruction on WonderHowTo to install and customize the app.
- Immersive Full-Screen Mode (paid app).
- (For the sake of completeness), Xposed Framework with "Immerse Me" module (require ROOT). Follow the instruction on phoneArena.com for step-by-step installation.
Note that by using these apps, your keyboard may not work properly.
Due to some security features in Android, users will not have access to the keyboard in many apps while in immersive mode.
Beware that your keyboard may not work in Immersive Mode, which is why having the toggle in the notification shade is so handy.