Is it safe to replace the thermostat when furnace is shut off?
It is safe from an injury standpoint to replace that sort of thermostat regardless of the furnace being on or off, since the voltage in the thermostat wiring is 24 V or less.
However, you haven't stated why you want to replace it, or what sort of thermostat you intend to install.  If you're looking at a programmable unit, or even a model with Internet connection, be aware that you may need a separate power feed to operate the thermostat itself.  Read the requirements on whatever thermostat model you're considering installing before buying.