It looks like more than one process could lead to a long vowel in a compound word where the corresponding independent word has a short vowel. Here is an overview of what I have found so far.
As Proto-Indo-European is generally reconstructed as having a phonotactic restriction against vowel-initial words, Greek vowel-initial words usually result from the loss of a word-initial consonant and/or the addition of a prothetic vowel. Some common consonants responsible for this are the laryngeals (plain *h₁, a-coloring *h₂, o-coloring *h₃), *w (aka u̯ or digamma), *s (which became *h), sometimes others like syllabic nasals.
The second element of a compound in Greek can take a different ablaut grade than the independent word, although the details of this are still unclear to me.
Types of compounds that may show long vowels
Late contraction of vowels in hiatus from loss of *w or *h (<*s)
As loss of digamma and /h/ occurred later than loss of other consonants, it seems that compounds with a vowel-initial second element that originally started in digamma or /h/ can show either uncontracted forms, or contracted forms that follow the typical Attic rules for contraction of vowels in hiatus. Smyth 878 says τιμωρός (from τιμή and ϝοράω) is an example where this process results in a long vowel; in the form κακοῦργος, which Smyth says corresponds to Epic κακο-εργός, contraction of ο-ε results in ου.
Smyth says the combining form corresponding to the verb ἔχω is -οχος, an example of the second element of a compound being in a different ablaut grade from the independent word. As ἔχω/-οχος comes from a PIE root starting with the consonant *s, Smyth says κληροῦχος and πολιοῦχος represent contraction of ο-ο (< *oho < *oso).
With words where the second element originally started with a laryngeal, the history of the vowels in the compound forms seems to be more complicated. Different sources give slightly different explanations that I don't understand enough to summarize right now. The most general explanation is lengthening either from contraction of adjacent vowels or in compensation for elision of a preceding vowel, but other mechanisms proposed to be relevant in at least some cases seem to be ablaut and certain laryngeal-specific sound changes such as the change from *n̥h₃ > νω mentioned in the Sihler quote in fdb's answer.
Some quotes from articles I have found:
"The origin of these lengthenings is more difficult to account for: the long vowel can either be an old contraction (as Wackernagel argued for), or can be the result of an elision followed by compensatory lengthening to account for the elision" (De Decker 2014, "Some etymological and morphological observations on the *h2o problem," pp. 50-51, citing "Berenguer-Sánchez 2011, especially 386")
With regard to compounds ending in -ωψ -ωπος and -οψ -οπος, "On the Derivation of Greek Αἰθίοψ and Αἴσωπος from a PIE Perspective", by Roberto Batisti (2019) says
Beekes (1995:18-25) draws a sharp semantic distinction : -ωπ- ‘eye’, ‘face’ vs. -οπ- ‘looking’. In principle, forms where the meaning ‘eye, face’ was present may have been influenced by root noun *h₃ṓkʷ- ‘eye, face’ >ὤψ* (Hom. acc. sg. ὦπα) with generalized lengthened grade (cf. φώρ φωρός ‘thief’). But the rule is not absolute (e.g. χαροπός ‘bright-eyed’, vs. many compounds in -ωπο- with a very faded meaning, e.g. χρυσωπός ‘gold-colored’, ξανθωπός ‘blond’); and both forms may have other origins:
in addition to lengthened grade, -ωπ- may reflect zero grade after *-e/o- and *-R- (and possibly after *-i-, *-u- , cf. §11), while -οπ- may reflect full grade but also zero grade after *C .
forms in -οπ(ο)- can also be compounds of the root (ϝ)οπ- < *u̯ekʷ ‘voice, speak’, and possibly absorbed one or more Pre-Gk./non-IE suffix(es).
(4.3, p. 4)