The error may be caused by a network connection error. In some cases, a firewall or antivirus is blocking the connection.Try to deactivate any such software temporarily for the download.
Workaround is to install MinGW Compiler manually:
1. Delete the MinGW installation files from: C:\Users\<username>\MATLAB\Downloads\SupportPackages\R2016b\downloads\R2016b If you do not find the MinGW files continue from step 2.
2. Download the installation files from the following webpage:
You will need the file tdm64-gcc-4.9.2.exe for 64-bit.
3. Start the installation. Deactivate the option 'Check for updates' on the welcome screen. Choose a path without spaces, e.g.: C:\TDM-GCC-64
5.Restart MATLAB and type below command in MATLAB command prompt:
This should now recognize the MinGW.