In the late 19th century it was a widely held belief that masturbation caused insanity and devices such as this were designed to prevent the wearer from touching or stimulating himself. They were often used in mental institutions and sometimes in the home.
Top device from the Wellcome Library in London.
Middle device an anti-masturbation “clamp belt”.
Bottom device made from copper, built in 1880 and used in Catholic France.
Via wellcome images, Oobject and boingboing.