Body snatchers weren't exactly evil criminals who were selling body parts on the black market. A lot of the time, the body snatchers and grave robbers were employed by doctors who wanted to study the human form in cadavers. In the 18th and 19th centuries, the only way that doctors could accurately treat their patients is by studying cadavers. Unfortunately, the idea of donating your body to science wasn't very popular.
In fact, only the bodies of prisoners were allowed to be dissected and studies. Doctors in training wanted to get their hands on the science, so they employed folks called resurrection men to steal dead bodies from graveyards. Of course, this was very secretive and the general public had no idea why bodies were going missing. So, they tried to protect them.
The mortsafe is one of the more well-known anti-snatching mechanisms. It was simply an iron gate fitted to the grave so that digging into the ground was made difficult. Since body snatchers only wanted fresh bodies, these mortsafes would stay on the grave for a few weeks before being reused on a newer one.
The body snatchers only had to dig up half of the grave plot. Then, they would break through the coffin and drag the body through a small-ish hole. In order to keep the body safe, an iron coffin collar would be put in place. Basically, it was a collar that was secured around the dead person's neck and then bottled to the bottom of the coffin. The corpse would be completely immoveable.
Lastly, a cemetery gun would sometimes be positioned at the foot of the grave with three tripwires that were low to the ground. If a body snatcher was coming up on the grave late at night, they would easily trip the wire and cause the gun to fire.