Iff and EMCON
IFF needs to be turned off in accordance with the EMCON state, like any transmitter. IFF responses will provide bearing information to any enemy able to receive. If you have the ability to interrogate, then it can give you range and bearing information.
For example, a simple TCAS unit can be purchased for a few thousand dollars, which will give range and bearing on any mode 3/3C transponders within range. It doesn't take much to modify these to operate mode 2 or 4.
So yes the threat picture will determine the EMCON state which may require IFF to be turned to standby. (You don't turn it off because they take a little time to warm up.)
On a side note, on most transponders, you should switch it to standby to change codes.