Penitentiary
late Middle English (as a term in ecclesiastical law): from medieval Latin paenitentiarius, from Latin paenitentia ‘repentance’. The North American usage dates from the early 19th century.
wiktionary
From Middle English penitentiary, from Medieval Latin pēnitentiārius(“place of penitence”), from Latin paenitentia(“penitence”), term used by the Quakers in Pennsylvania during the 1790s, describing a place for penitents to dwell upon their sins.
etymonline
penitentiary (n.)
early 15c., penitenciarie, "place of punishment for offenses against the church," also "a priest appointed to administer the sacrament of penance," especially in extraordinary cases, from Medieval Latin penitentiaria, from fem. of penitentiarius (adj.) "of penance," from Latin paenitentia "penitence" (see penitence).
The meaning "house of correction, prison in which convicts are confined for punishment and reformation and compelled to labor" (originally an asylum for prostitutes) is from 1806, short for penitentiary house (1776). Slang shortening pen is attested from 1884.
As an adjective, from 1570s as "relating to penance," by 1791 as "expressive of contrition."