Examples:
- 帰国する先輩から自転車を譲ってもらったので、新しいのを買わなくてすんだ。I got a bicycle from my senior who returned to Japan, so I didn't have to buy a new one.
- 今朝乗っていた電車が一時運転見合わせになったけど、早めに家を出てたので遅刻せずに済んだ。The train I was on this morning was temporarily suspended, but I left home early so I didn't have to be late.
- 今回は風邪の症状が軽かったので、病院に行かずに済んだ。I didn't have to go to the hospital because I had a mild cold this time.
It can mean "you don't have to do what you originally intended to do", or it can mean "avoid what might happen."