Is it possible to use autodiff on an external program?

Yeah!

You could llvmcall the IR directly if you compiled it elsewhere, or alternatively you could compile your simulation with embedded bitcode and Enzyme would be able to differentiate through the ccall.