If NEURON is compiled --without-iv, a working hoc program will still run, but no attempt will be made to draw anything to the (nonexistent) graphical user interface. The documentation for save_session() says
. . . save_session("filename")
. . .
Save all the (saveable) windows on the screen to filename.
On a machine that has no GUI, there will be no NEURON windows at all, so the session file will necessarily be empty.
If you are performing optimizations and need to save parameter values in an environment in which NEURON has no GUI, you'll have to write your own procedures for printing them to an output file, and reading them from such a file and restoring them to your model and/or optimizer tool, as appropriate.