In case someone happened to be buried alive,the person could ring the bell to alert others and be saved from the grave.This idiom is also used a lot during boxing mathches in which one boxer is "saved by the round bell",meaning that the boxer has a short time to rest and recover.