Just about every society on earth has its prison houses or jailhouses (gaols, to the British). To most people it has seemed simply logical that, in order to contain the damage done by criminal elements in society, they have to be restrained in some place where society will be safe from them.
Some societies, or some eras, have even gone to such an extreme as to place erring or undesirable individuals in some dank, damp and dark dungeon — a hole in the earth. Even before medieval lore and now computer games, people like Joseph had been given the dungeon treatment in Egypt (Genesis 40:15; 41:4). So had the prophet Jeremiah been treated centuries later (Jeremiah 37:16 – 38:13).