Foucault studied under Louis Althusser, an influential Marxist thinker, who examined the way social systems control human subjects. Althusser noted that human subjects are molded via certain ideologies which are enforced by Ideological State Apparatuses (using ideology to enforce ways of being) and Repressive State Apparatuses (using force).
Foucault studied the function of ideology and the "power" to enforce ideology in social systems. Foucault made a particular study of the medical field in these respects. He also studied the way social institutions (hospitals, military, and prison to name a few) molded human subjects; similar to the way Althusser believed social systems, and apparatuses, molded subjects as well.
Foucault often used the term "subject" to refer to a person. A person is a subject, like the "I" of a sentence, but a person is also "subjected" to modes of power. So, Foucault examined many of the ways subjects are subjected to power. For example, writing about authors, he looked at the social forces that informed an author's work, rather than simply focusing on that author's intent. ("What is an Author?") Foucault also examined the hierarchy of teachers over students and of clinicians over patients. Foucault spoke/wrote of "docile bodies" underscoring the ways subjects are conditioned by social systems which have personnel in hierarchical positions: teacher/student, doctor/patient, politician/subject. He examined how power is used to determine the roles of human subjects in terms of nationalism, behavior, gender roles, sexuality, etc.
In "Discipline and Punish: The Birth of the Prison," Foucault discusses Mettray, a prison for juvenile criminals. Of the administrators, he writes:
The chiefs and their deputies at Mettray had to be not exactly judges, or teachers, or foremen, or non-commissioned officers, or 'parents', but something of all these things in a quite specific mode of intervention. They were in a sense technicians of behaviour: engineers of conduct, orthopaedists of individuality.
This is a description of a prison but one can see how this system of enforcing power is similar in Foucault's work on other social institutions. One of the ways power is enforced is the use of permanent observation. If the subjects thought they were always being watched, they would always tend to behave accordingly. From this idea comes the term "panopticon" which means "all-seeing," a term that comes from philosopher Jeremy Bentham.
Foucault, in studying history, had a general suspicion of social institutions. He recognized how powerful institutions controlled the means of producing subjects, behaving in certain ways, and producing what was given as "truth" or law. He discusses this in "Truth and Power":
It's not a matter of emancipating truth from every system of power (which would be a chimera, for truth is already power) but of detaching the power of truth from the forms of hegemony, social, economic and cultural, within which it operates at the present time.
That is, it is a matter of detaching the power and use of truth (real truth) from the dominant ideologues (hegemony) and from social institutions who use (and often manipulate or alter) truth in order to condition human subjects to live such that those subjects continue to behave and reproduce themselves in their "subjected" positions.