Now how would expressing error prone DNA polymerase during stress maximize the survival chances of a bacterial population?Seems to be pretty straightforward. If it did not "change", "it" would die, which it does eventually. But to the more immediate concern, the bacteria "adapts". The real question is how it "knows" it is under stress in order to react to the stress.
It isn't anything magical - a bacteria senses stress via molecular signal transduction resulting in activation of specific transcription factors that cause the expression of stress response genes.