A prison, or gaol, was a place of confinement, typically for criminals.
In 1881, while in Tombstone, Arizona, the First Doctor was imprisoned by Wyatt Earp who believed this would be safer for the Time Lord who was believed to Doc Holliday by Seth Harper and the Clanton brothers.
A mob, egged on by the Clantons, gathered outside the prison demanding that Holliday be released into their custody and threatening to hang Steven Taylor if not. Earp attacked the group and managed to release Steven. The Doctor was released and surreptitiously removed from the prison. (TV: The Gunfighters)
Occasionally, mugshots were taken of convicts to process them for imprisonment. After being caught with a vehicle carrying stolen merchandise which they themselves stole, the Doctor and Sarah Jane Smith were lined up for mugshots. Both of them struck cheesy grins, mocking their frustrating predicament. (TV: Invasion of the Dinosaurs) The Ninth Doctor, having witnessed his companion seemingly killed before being arrested by the security of the Game Station, faced his mugshot with a stoic look. (TV: Bad Wolf)