Chastity belts were not invented in the Middle Ages (5th-15th centuries) to prevent women from losing their virginity. They were invented in the 18th century to prevent teenagers from masturbating because they thought masturbation led to insanity. More info on Wikipedia.
.