Edward Said writes in chapter 1 of Orientalism that he applies Foucault's idea of discourse to the discussion of Orientalism.
I have found it useful here to employ Foucault’s notion of a discourse, as described by him in The Archaeology of Knowledge and in Discipline and Punish, to identify Orientalism. My contention is that without examining Orientalism as a discourse one cannot possibly understand the enormously systematic discipline by which European culture was able to manage—and even produce—the Orient politically, sociologically, militarily, ideologically, scientifically, and imaginatively during the post-Enlightenment period.
Foucault's definition of discourse is "a body of thought and writing that is united by having a common object of study, a common methodology or way of speaking about that object/thing, and/or a set of common terms and ideas."
Example: The discourse of alcoholism would include writings by rehabilitation facilities, writings from Alcoholics Anonymous, writings by doctors who study the effects of alcohol, novels about alcoholism/alcoholics, autobiographies written by alcoholics, and other writings related to alcoholism.
This explanation of discourse allows one to study works across time and genre and to realize that ideas and concepts aren't necessarily the creation of one individual person.
Orientalism is a way of talking about and representing the Orient; therefore, it becomes valuable for one to look at works across genres of writing and time periods to analyze how views of the Orient were produced through the lenses of Europeans and how those views evolved or stayed the same. Said looks at texts from various European countries, from poets, novelists, politicians, and so on, and makes them a unified body of discourse—a common object of study. Through this discourse, these various writings from various people, countries, and so on, it becomes evident that the same ideas and images of the Orient are repeated in different texts by different people and in different time periods. It illuminates the concept of "otherness" and how Europeans were looking through Western lenses to portray the Orient.
I have included a reference link from an English journal that further explains the link between Foucault and Said's discourse.