Way back, some would run a string from inside the coffin attached to a bell above ground, ostensibly so the prematurely buried individual could alert people above ground. The fear of being buried alive was not entirely irrational. Many diseases appeared to mimic death prior to the ability to test for brain wave activity, very slight pulse, etc.
Some attribute the expression, “saved by the bell”, to that old custom.