And can it be traced back to one culture?
Hot darn! I've never had the chance to meaningfully contribute to /r/askhistorians before! However, I am going completely off memory, so I recommend you check out American Prisons: History of Good Intentions for a comprehensive, if under-critical, take on the history of prisons in America. Skip to the tl;dr if you'd like.
So the first thing you have to understand when answering this question is that there is a difference between imprisonment as in holding someone against their will, and imprisonment as in holding someone as punishment for a crime they committed. That might sound obvious, but the historical timelines for the two are radically different. To the first, I honestly couldn't tell you when they originally arose. I can, however, tell you that the latter (prisons as a means of corrective action) sprang from the former.
Prison was originally used (circa 1500s) as a tool not explicitly for punishment, but for rounding up those committing what we would typically consider anti-social behavior: vagrants, drunks, and the like. Debtors were also held in these cells, as were pretrial subjects and more serious criminals awaiting corporeal or capital punishment. Additionally, there are other institutions similar to prisons that were established around this time, such as poor houses,where the destitute were ostensibly given shelter but in exchange had to work and live in near prison-like conditions. The important thing to understand is that in all of these cases, people were not in prison as an explicit punishment, but as a consequence of the need to physically restrict someones movement until further action could be taken.
By the 1700's two intertwining forces lead to the rise of prisons. First, urbanization and higher populations meant more vagrants, mentally ill, and drunks in these prisons, which meant worsening standards. Jails became such abhorrent institutions that Parliament commissioned Thomas Howard, a Sheriff in England, to spend two years touring the European continent to observe the best practices for maintaining jails.
Secondly, Enlightenment ideals tended to look very poorly on notions like corporeal punishment. This is best epitomized by Casare Beccaria's On Crimes and Punishment (1764), in which he writes, “the purpose of punishment is not to torment a sensible being, nor undo a crime already committed...the end of punishment, therefore, is no other than to prevent the criminal from doing further injury to society and to prevent others from committing the like offense.” In essence, denial of freedom of movement became viewed as a humane (and perhaps more effective) tool for deterring crime than other forms of punishment.
I don't have any stats on per-Enlightenment crime and punishment in Europe, but to give you some perspective on how it worked in America, some southern colonies in the 1700's featured over 160 executable offenses. 402 people were executed in New England between 1700-1773, and over half of them were for convictions other than murder. In Pennsylvania, renowned for its Quaker compassion, there were still over a dozen capital-offense crimes, including ‘lesser’ areas of wrongdoing such as assault and property destruction. (For more on this check out Buried Lives: Incarcerated in America).
But after American Independence progressive legislatures (most notably the Quaker legislature in PA) sought to differentiate themselves from England and Europe, and restructuring crime and punishment was one of the ways to do that. With ideas built off of the Enlightenment as well as a sense of Puritan work ethic, they repealed capital punishment for all but two charges, and instead replaced them with hard labor. After some trial and error, Philadelphia became famous for the "Cherry Hill" style of penitentiary.
Located in Philadelphia, the Eastern State Penitentiary on Cherry Hill had a highly innovative wagon-and-spoke design that that allowed the total isolation of prisoners in single cell units that radiated in long, rectangular cellblocks from a central courtyard. This reflected the belief that the most profound way to reform a criminal was to force them to sit in constant solitude where they had no choice but to contemplate (and eventually repent for) their sins. Individual isolation also protected prisoners from the total lack of control that had characterized local jails. Quaker industriousness dictated that prisoners should engage in handicrafts (e.g. cobbling shoes, spinning yarn), but this was seen as a means towards rebuilding the criminal’s sense of ethic more so than a profitable venture for the prison itself.
This came to contrast with the "Auburn style", where solitary confinement was only designed for off-hours, and even then only for more hardened prisoners. Focus was placed instead on total silence between inmates, who were forced to labor together during the day in workhouses. While based around similar Puritan values of reflection and obedience, in reality the Auburn system thrived because it allowed for prisons to become a break-even, if not profitable, venture for the state.
Ultimately, and like you'll see with much of the history of prisons, there were a lot of paternalistic progressives, some well-intentioned and others not, who thought that prisons did a lot more good than they actually were. Both of the systems were rife with corruption and prisoner abuse, and they both began to fall out of fashion by the 1840s or so.
Some other quick notes about the history of prisons because I'm getting tired:
America was (generally) the world leader in prison-theory experimentation. European delegates often came to America to study the latest innovations out of Auburn and Pennsylvania.
The American South is a different story entirely. Let me just put it this way...I would NOT have wanted to be in a Georgia prison in 1850.
The Civil War (and the lead up to it) caused something of a respite in the debate over prison policy, so the move away from Auburn/Cherry Hill style prisons did not occur until a decade or two later than it might have otherwise.
Interestingly, the rise of labor unions in the late 1800s were instrumental in the demise of Auburn's prison-labor model. Prison labor was a direct competitor with
Up until the late 1800s, an effective prison was considered one that turned a profit. The notion that prisons were a cost that the state should take on did not fully take rise until the early 1900's/late 1800's.
This was also when prison libraries, educational courses, and technical training began to take hold.
Parole began to be used as a tool in the early 1900s.
**tl;dr Prisons (more truthfully, jails) were originally used simply as a temporary tool to hold criminals and other socially unwanted persons as they awaited the execution of their punishment (be it corporeal, exile, or capital). The notion of imprisonment as a corrective action became an idea in the mid-1700s, and began to be executed in the early 1800s. Methodology of imprisonment evolved a lot throughout the century, and what we consider to be modern prisons did not come about until the beginning of the 20th century.
Imprisonment as it is practiced and understood today originated in the 18th century and grew with the emergence of capitalism.
Might want to check out Discipline and Punish: The Birth of the Prison by Michel Foucault.
Foucault relates the development of the prison to the development of factories, schools, barracks, hospitals, etc.