Installing on Windows
Using prebuilt binaries
You can download prebuilt binaries. Unpack the ZIP file and you can immediately use osm2pgsql.
Compiling from source
For native Windows compilation you need a C++17-compatible compiler. Follow the usual steps for compiling CMake projects.