Short answer: English spelling does not display a one-to-one correspondence with pronunciation, and certainly not with modern pronunciation. You shouldn't expect it to.
Medium answer: These words are spelled with the same letter combination but pronounced with different sounds due to a combination of different etymologies, and different sound changes. Some of them started out with different pronunciations and stayed different; some of them started out with the same pronunciations and diverged over time.
Long answer: Some words have spellings in modern English that never corresponded to their pronunciations and were only established by analogy with other words with a similar meaning. This seems to be the case for the following two words spelled with "ough":
hiccough: the word is not actually derived from cough. But people started spelling it with -ough because they thought it seemed similar to cough. The more regular spelling with "up" is still commonly used.
furlough, which comes from Dutch verlof; I have no idea why it changed pronunciation and spelling.
There are many other words that exhibit this phenomenon: island (never pronounced with an s), scissors (with extraneous s; it comes from the root cis- as in incision but was mistakenly thought to come from the root sciss- as in scission), foreign (never pronounced with g; it was apparently respelled by analogy with words like sovereign), ptarmigan (never pronounced with p).
However, most words spelled with gh did originally have a corresponding consonant sound in this position: a velar fricative /x/ (which can still be seen in related words in some other Germanic languages, as Roger Mue's answer shows). The spelling gh was one of the usual ways of representing this sound in Middle English. The words are pronounced differently now because they underwent sound changes. In all languages, words change in pronunciation over time. In some words, the sound /x/ changed to /f/ (see this question to learn why: Why did /x/ change to /f/ in English?), while in others it was dropped, but caused the previous vowel to become a diphthong. The sound change turning /x/ to /f/ only applied sporadically, so the sounds in some words shifted one way while in others they shifted a different way. The vowels also changed in various ways, sometimes irregularly.
To try to see if there were any regular patterns, I divided the words into several "classes" based on how they are pronounced.
Example words for different pronunciations of "ough"
I'll use the abbreviation "OE" to stand for "Old English" and "ME" to stand for Middle English. Be aware that the historical forms I list are not comprehensive. The forms are taken from the Oxford English Dictionary (OED), New Oxford American Dictionary, and Wiktionary. The words on the left have an arrow < pointing to them to show that they descend from the words on the right. Words preceded by an asterisk are hypothetical/reconstructed rather than attested forms.
ough = /ɔː/ "aw" sound as in jaw:
- thought < OE þōht
- sought < OE sōhte
- bought < OE bohte
- nought < OE nowuht
- wrought < OE wroht
- ought < OE āhtan
- fought < OE feaht/fuhte/fohten
- daughter (variants dofter, dafter) < OE dohtor
Very nearly, "ough" is pronounced /ɔː/ in all words and only words spelled with "ought". (I know "daughter" isn't even spelled with ough today, but it has a similar history and the same pronunciation.) It's unclear to me why the pronunciation developed this way in these words, but it seems quite regular. The one exception I've been able to find, drought, can be explained if we look at the history: it comes from Old English drūgað, which, unlike all of the other ought words, had the long "ū" vowel. The long "ū" sound of Old English came to be spelled "ou/ow" in the Middle English period by historical accident; this caused it to be spelled the same way as some other unrelated sounds, such as the "ow" sound in words like crow. (More on that here: Why does “ow” have two different sounds?).
ough = /aʊ/ "ow" sound as in cow:
- bough < OE bōg/bōh
- plough/plow < OE *plōg/plōh
- enow < OE genōg/genōh
- slough (n) < OE slōg/slōh (—also has /uː/)
sough (v/n) < OE swōgan (v), ME *swōh, swōȝ (n) (—also has /ʌf/, maybe had /ɒf/)
The words listed above all had long "ō" in Old English. Normally, this developed to an "oo" sound (as in goose), but it seems to have followed a different path in these words. It seems that it joined with long "ū" in Middle English, and then developed to the diphthong that is currently present (Eilert Ekwall, ed. 1907, Dr John Jones's Practical Phonography (1701)). (One possible exception is slough, which is often pronounced as sloo/slew.)
I think we could compare this to the development of some Old English /e/ or /ea/ followed by /g/ or /x/ to late Middle English long "ī," as in the words "eye" < OE ēage and "die." (And interestingly, this change also seems to have been sporadic: compare the pronunciations of "eight" and "height.")
Another possibly significant fact is that all of the above words had variants with g instead of h in inflected forms, such as the plurals; and in fact the now-archaic enow was used as the plural form of enough. I found that several authors say for this reason that these forms actually derive from Old English forms with g rather than with [x] (Wyld 1907). Old English single /g/ was vocalized between vowels, so if the etymology from these forms is accurate, the overall development would have been something like [oːg] (Old English) > [oːw] > [uː] > [aʊ]. This is distinct however from what seems to be the usual development of Old English [oːw] (as in "flōwan" > modern "flow," with [oʊ] not [aʊ]).
drought; discussed in the explanation of the "ought" words above, in 1.
ough = /oʊ/ "oe" sound as in toe:
- thorough < ME þorwe among other forms < OE þurh
borough < ME burwe among other forms < OE burg/burh
The significant fact here is that "ough" is in an unstressed syllable in both of these words where it is pronounced as /oʊ/. I would guess these developed similarly to words like furrow (from ME forwe among other forms < OE furh), arrow (from OE earh/arwe), and sparrow (from OE spearwa). That is, the final h or g was replaced with the semivowel w, which subsequently developed into an oaw sound. For some speakers, the current pronunciation has developed further to a schwa sound /ə/.
dough < OE dāh
This word had long "ā" in Old English. Normally, this developed to an "o/oa/oe" sound in Modern English (as in cold, stone or toe) and this seems to have occurred here as well, as least for the standard pronunciation. One dialectal pronunciation is discussed further down.
though < Old Norse *þōh
This is another word that shows several phonetic variants in different dialects, which perhaps is to be expected as it seems to have a complicated etymology. The Oxford English Dictionary gives the following explanation:
Old Norse *þóh (intermediate to þauh and þó), [was] shortened
in Ormin to þŏhh, with subseq. stress-lengthening to þōuȝ, though,
thō. The Norse form gradually gained over [the Old English forms], which
disappeared from literature before 1500. [Other] forms show the same
development of f < ȝ, gh /x/, as in laugh, cough, tough; thof
was occasional in literature as late as 1750, and is still prevalent
in many varieties from Yorkshire and Lancashire to Hampshire and
Devon: see Wright Eng. Dial. Gram. In Scotl. and north of Engl.
though is pronounced /θɔː/; the Hampshire and West Somerset thof also is /θɔf/, not /ðɔf/.
ough = /ɒf/ "off" sound:
- cough < OE *cohhian
trough < OE trog/troh
These two words have the normal “short o” vowel. This makes sense because they both had a short "o" in old English, although it was pronounced differently from how it is now (it was literally a shorter version of the long ō sound). However, there are not enough ough words with this pronunciation in Modern English to say if the development was "regular" or not. They also show the change of [x] > /f/.
sough (n) < OE swōgan (v), ME *swōh, swōȝ (n) (obsolete variant pronunciation): the OED entry for the noun sough says "The pronunciation /sɒf/ is given by Smart (1836) and Ogilvie (1850)." But it is usually pronounced with /aʊ/ or /ʌf/. This word is ultimately from Old English swōgan, with a long vowel, so the development to /sɒf/ could indicate the activity of some kind of shortening sound change in this context. However, the pronunciation might have been altered by analogy rather than by a sound change.
ough = /ʌf/ "uff" sound:
- duff (variant pronunciation listed by the OED for "dough") < OE dāh
- enough < OE genōg/genōh
- tough < OE tōh
- rough < OE rūh
- sough (v/n) < OE swōgan (v), ME *swōh, swōȝ (n) (—also has /aʊ/, maybe had /ɒf/)
- slough (v) (uncertain origin)
- chough (precise ancestor of this phonetic form unclear)
This set appears to be the most heterogeneous. They all show the shift of the consonant [x] to /f/. In addition, it appears that the vowels in these words underwent two processes before this consonant: shortening and a change of vowel quality (perhaps not in that order). Duff, enough and sough all have alternative pronunciations descended from the same origin, which seems to indicate that there is no definite way to tell from a word's etymology that it will be pronounced with "uff."
ough = /uː/ "oo" sound:
- through < OE þurh
- slough (n) (some varieties)
According to the OED, the vowel sound used for ough in through is the result of re-stressing a vowel that had become unstressed (the word originated as an unstressed version of thorough). There are other examples of this sort of thing in English: the re-stressed "ay" /eɪ/ is used as a strong form of the indefinite article "a," which originated as an unstressed version of the numeral "one"; the re-stressed "ov" /ɒv/ (in British Englis) or "uv" /ʌv/ (in American English) is used as the strong form of the preposition of, which originated as an unstressed version of the preposition off. "Slough" with /uː/ is weird and I don't know how to explain it. It might be due to dialectal variation.
There is also some variation between these pronunciations for several words.
- Henry Cecil Wyld, 1907, The Growth of English: An Elementary Account of the Present Form of Our Language, and its Development, by Henry Cecil Wyld
- William Labov, "Regular Sound Change in English Dialect Geography," in History of Englishes: New Methods and Interpretations in Historical Linguistics, 1992, edited by Matti Rissanen, Ossi Ihalainen, Terttu Nevalainen, Irma Taavitsainen