There's a theory that the phrase saved by the bell means a way for people mistakenly buried alive to save themselves. In Victorian times a grave was equipped with a bell that had a string that was tied to the dead person's finger. Then if they woke up and found themselves in a coffin they could ring the bell and be rescued. I like the theory, that's smart thinking. But alas, while that is something they did in Victorian times it isn't where the phrase comes from.
The phrase actually comes from the boxing ring. Click here to read more about it.
And when we use the phrase these days we are saying that we have been saved from something just in time, just before it could have gone wrong.