Castles as prisons. Castles were ideal places to lock up prisoners, because they were strong buildings that were difficult to escape from. Prisoners were locked away in a tower or underground in a dungeon. In the Middle Ages, most prisoners were noblemen captured in war who were held for ransom.