GENERALIZATION:
If something is included, it should be analyzed, even if it will never be compiled and linked, so the compilation time will probably increase - Do not include unused headers .
RUNTIME:
It has already been mentioned by @DonReba that unused headers may contain some pragma directives that can modify the resulting executable, but this is usually not the case.
Most unused functions and declarations will be optimized, except for some specific cases - Will unused functions be optimized? . The exe result may become a little big, but these functions and variables will not be used, so the overall impact will be minimal. - - However, do not include unused headers .
SUMMARY:
If you can change the source code to not include anything superfluous, change it.
Personnaly I prefer to have standalone modules (headers) that include everything they need - nothing more, nothing less. Such modules can be added and removed without delay and the possibility that some unnecessary dependency remains. They are still not a panacea, but in combination with attentiveness and some code analysis, they will keep your program free from deadweight files.
EDIT:
Precompiled headers:
Precompiled headers are used to reduce compilation time for commonly used but rarely modified headers (system headers, large project headers), so if these unused headers are included in the precompiled header, then the effect of compile time during subsequent compilations will be minimized. However, all run-time problems, regardless of how small they are, remain the same as for a simple header.
source share