In American English, prison and jail are often treated as having separate definitions. The term prison or penitentiary tends to describe institutions that incarcerate people for longer periods of time, such as many years, and are operated by the state or federal governments. The term jail tends to describe institutions for confining people for shorter periods of time (e.g. for shorter sentences or pre-trial detention) and are usually operated by local governments. Outside of North America, prison and jail have the same meaning.
Prisons can be used as a tool of political repression to punish what are deemed political crimes, often without trial or other legal due process; this use is illegal under most forms of international law governing fair administration of justice. In times of war, prisoners of war or detainees may be detained in military prisons or prisoner of war camps, and large groups of civilians might be imprisoned in internment camps.
Common slang terms for prison include: "stir", "the pokey", "the slammer", "the clink", "the joint", "the calaboose", "the hoosegow", "the big house", and "up the river" (a possible reference to Sing Sing).
The use of prisons can be traced back to the rise of the state as a form of social organization. Corresponding with the advent of the state was the development of written language, which enabled the creation of formalized legal codes as official guidelines for society. The best known of these early legal codes is the Code of Hammurabi, written in Babylon around 1750 BC. The penalties for violations of the laws in Hammurabi's Code were almost exclusively centered on the concept of lex talionis ("the law of retaliation"), whereby people were punished as a form of vengeance, often by the victims themselves. This notion of punishment as vengeance or retaliation can also be found in many other legal codes from early civilizations, including the ancient Sumerian codes, the Indian Manama Dharma Astra, the Hermes Trismegistus of Egypt, and the Israelite Mosaic Law.
Some Ancient Greek philosophers, such as Plato, began to develop ideas of using punishment to reform offenders instead of simply using it as retribution. Imprisonment as a penalty was used initially for those who could not afford to pay their fines. Eventually, since impoverished Athenians could not pay their fines, leading to indefinite periods of imprisonment, time limits were set instead. The prison in Ancient Athens was known as the desmoterion ("place of chains").