In Discipline and Punish, Foucault describes the development of the modern prison. He begins with a 1775 execution to show the progression from torture/execution to imprisonment. Although imprisonment seems like a more humane form of punishment than torture or execution, Foucault shows the ways in which the prison system is a metaphor or microcosm of power structures in society. The prison system, while being a metaphor for how power functions, is also a literal, physical outgrowth of power structures. In this text, Foucault describes his famous panopticon, which he derived from Jeremy Bentham. The panopticon in a prison yard is a position in a tower which offers the tower attendant a vantage point from where he can see the entire prison, and no one can see him in the tower. The effect is that the inmates are always already aware of being watched but do not know who is watching them and where that watcher might be.
Inasmuch as reformers used prisons to keep others safe and, ideally, rehabilitate criminals to become productive members of society, Foucault argues that this also established a precedent of training obedient subjects. In "The Carceral" from Discipline and Punish, Foucault writes:
By operating at every level of the social body and by mingling ceaselessly the art of rectifying and the right to punish, the universality of the carceral lowers the level from which it becomes natural and acceptable to be punished.
In other words, the disciplining practice of the prison (carceral) system, as long as it is accepted by the people and the state, is made legitimate. And if it is agreed that punishment is legitimate, the practice could be used in other aspects of society. And the powers that be, in a social institution, can best enforce certain behaviors among their inmates/citizens by constant observation (panopticon), or to instill in those subjects the feeling that they're being watched.
Foucault notes that prisons serve a function. His purpose is to seek to illuminate the ways power is used to coerce subjects to conform, and the prison setting is a very good way to show those power structures. Subsequently, other theorists have delved into other applications of Foucault's ideas. For an everyday example, to create obedient consumers, a beer company will advertise their product as much as possible, particularly targeting times/places with cultural links to beer (such as sporting events). Essentially, the beer company is trying to make a profit by conditioning consumers to want to like their product. And advertising can be a form of observation: although it is the consumer who sees the advertisement, the consumer knows that the company is thinking of them, targeting them, and coercing them to buy their product.
This is one application of Foucault's panopticism and the use of coercion to create a desire for conformity. Foucault gives other examples in the book to show how discipline/coercion is used; i.e. juvenile facilities, schools, and hospitals.