Compilation is the process of translating source code written in a high-level programming language into a lower-level language, such as machine code, so that it can be executed by a computer. This process involves several stages including lexical analysis, syntax analysis, semantic analysis, optimization, and code generation to ensure the program runs efficiently and correctly.