By forming this structure some bacteria can survive harsh condition?

They form an endospore. An endospore is a thick cell wall that helps protect them.

Endospores enable bacteria to lie dormant for extended periods of time when the environment is unfavorable (such as extreme temperatures, radiation, extreme pH levels, extreme pressures and harmful chemical agents). Then, when the environment becomes more favorable, the endospore can reactivate itself to the vegetative state.