Static linking occurs before program execution. It happens during the compilation phase of the software development process. Static linking combines all necessary libraries and object code into a single executable file, creating a standalone program that can be executed independently without needing external dependencies during runtime.