Many castles throughout the country have become ruined because they no longer needed to serve the purpose that they were built for. Some though found alternative uses like with Lancaster Castle being used as a prison (it only stopped being used as a prison in 2011), which have helped them to survive to the present day.
When we think of castles our minds are filled with the glorious imagery of Knights and Damsels, and also of the dark and miserable Dungeons full of prisoners.
The English language has had a strong connection to French since the beginning of the Middle Ages as we were conquered by the French speaking Norman's in 1066. The heart of the castle is the Keep, which in French was called the Donjon.
Do you see the link yet? But how did we get from the French word for Keep to the image of the dark and wretched dungeon that we now have?
Well to answer that we need to think like a Medieval Knight. If you went to battle and could take a/some prisoner(s) would you chose:
A) a peasant (no ransom value) B) a man at arms (very small ransom value) C) a Knight/noble (very high ransom value)
You are probably going to only bother taking someone prisoner if they will fetch you a tidy ransom from their household in exchange for their freedom. This is where we also get terms like "a King's ransom", like when King Richard I was held captive by The Holy Roman Emperor Henry VI in exchange for 150,000 marks. It is very difficult to convert money over such a long period of time, but we have seen estimations that that 150,000 marks in 1198 would be worth anywhere between £17m and £3.3bn in today's money!
Next we need to think where we would put these prisoners. Would you keep them:
1) in the cellar (very uncomfortable) 2) in the gatehouse (reasonably comfortable but easy to escape from) 3) in a room on the top floor of the Keep/Donjon (very comfortable but difficult to escape from)
When stone castles were built their windows were very small (thin) to make it easier to defend, so your prisoner wouldn't be able to escape through there. Even if they could, the fall to the ground below would have likely been fatal (or crippling at best). Also if you were keeping a "high value" prisoner you would probably want them to be well looked after. Besides, if you were to be captured by them in a future battle you might hope for your hospitality to be returned.
As feudal medieval England gave way to the Tudor dynasty and the renaissance (as well as the development of cannons) castles lost their importance as defensive structures and were either neglected or repurposed (some into stately homes of their day). The narrow arrow slits were removed in place of large windows to let in more light. The need to host high value hostages gave way to local law and order. Some castles developed a notorious reputation for torture and ill treatment of prisoners. These new "low value" prisoners were kept in the dark and damp cellars, though as these cellars were being used to house prisoners the French term donjon (or dungeon) moved with them to the cellars giving this idea of the scary and haunting dungeons that we think of today.
So it's quite ironic to think of prisoners being kept in castles today. It is in fact what they have been used for since the Middle Ages.