This essay explores the historical relationship between mental health and the prison system in England and Ireland, from the introduction of the separate system of discipline in the 1840s. In doing so, we focus on the persistently high rates of confinement of prisoners with mental health problems as well as the impact of prison regimes in producing or exacerbating mental illness. Despite recognition of the harmful relationship between the prison and mental disorder, responses by prison medical officers were stymied by their complex tasks of managing and treating mental illness and preserving prison discipline. Our account concludes by drawing out continuities from the nineteenth to the twenty-first century in terms of the obstacles to the effective care of mentally ill prisoners.