At 400 ppb, fluorine is estimated to be the 24th most common element in the universe.  It is comparably rare for a light element (elements tend to be more common the lighter they are).  All of the elements from atomic number 6 (carbon) to atomic number 12 (magnesium) are hundreds or thousands of times more common than fluorine except for 11 (sodium).  One science writer described fluorine as a "shack amongst mansions" in terms of abundance.  Fluorine is so rare because it is not a product of the usual nuclear fusion processes in stars.  And any created fluorine within stars is rapidly eliminated through strong nuclear fusion reactions—either with hydrogen to form oxygen and helium, or with helium to make neon and hydrogen.  The presence of fluorine at all—outside of temporary existence in stars—is somewhat of a mystery because of the need to escape these fluorine-destroying reactions.
Three theoretical solutions to the mystery exist: In type II supernovae, atoms of neon could be hit by neutrinos during the explosion and converted to fluorine. In Wolf-Rayet stars (blue stars over 40 times heavier than the Sun), a strong solar wind could blow the fluorine out of the star before hydrogen or helium could destroy it. Finally, in asymptotic giant branch (a type of red giant) stars, fusion reactions occur in pulses and convection could lift fluorine out of the inner star. Only the red giant hypothesis has supporting evidence from observations, fluorine cations  have been found in planetary nebulae.
In space, fluorine commonly combines with hydrogen to form hydrogen fluoride. (This compound has been suggested as a tracer to enable tracking reservoirs of hydrogen in the universe.) In addition to HF, monatomic fluorine has been observed in the interstellar medium. Fluorine cations have been seen in planetary nebulae and in stars, including the Sun.