This is turned off by default. Previously to Android Oreo, there was a single setting to enable/disable this option. Since Android Oreo, this is an application specific setting.
To enable this for an app, go to Settings -> Apps -> 3 dot menu -> Special access -> Install unknown apps. There you can select the app that you want to use to download an app from an unknown location.