I'm not an etymology expert, but they do not seem to be connected. I haven't found any source that links the etymology of these two words. The correspondences between Germanic languages seem to be fairly clear, and allow us to reconstruct the ancestor of "ghost" in Proto-Germanic as *gaistaz or *gaistoz and the ancestor of "guest" in Proto-Germanic as *gastiz: two distinct words.
I know of no derivational process in Indo-European languages that sticks y/i in the middle of a root, so I don't see how these words could stem from a common root of the form "g-st" or something. I guess there is still the possibility that they're both derived from a root of the form "g-" (PIE *gʰ) or that they both share a suffix "-st" or "-t," but these kind of one or two-letter coincidences aren't very strong evidence for common origin.
Here is what I've found about the etymology of these words.
According to the Online Etymology Dictionary, "ghost" comes
from Proto-Germanic *gaistaz (source also of Old Saxon gest, Old
Frisian jest, Middle Dutch gheest, Dutch geest, German Geist "spirit,
ghost"). This is conjectured to be from a PIE root *gheis-, used in
forming words involving the notions of excitement, amazement, or fear
(source also of Sanskrit hedah "wrath;" Avestan zaesha- "horrible,
frightful;" Gothic usgaisjan, Old English gæstan "to frighten").
According to the Oxford English Dictionary, "ghost" is from
Germanic type *gaisto-z. Although the word is known only in the West
Germanic languages (in all of which it is found with substantially
identical meaning), it appears to be of pre-Germanic formation. The
sense of the pre-Germanic *ghoizdo-z, if the ordinary view of its
etymological relations be correct, should be ‘fury, anger’; compare
Sanskrit hḗḋas neuter anger, Avestan zōižda- ugly; the root *gheis-, *ghois- appears with cognate sense in Old Norse geisa to rage, Gothic usgaisjan to terrify (see gast v.1); outside Germanic the derivatives seem to point to a primary sense ‘to wound, tear, pull to pieces’.
The Old English form gǽst is constant in the Exeter Book, and occurs
49 times in the Hatton MS. and 3 times in the Bodl. MS. of Alfred's
translation of Gregory's Pastoral Care; it is apparently not known
elsewhere. The occurrence of gǽst < *gaisti- beside gást < *gaisto- is
explained by Sievers ( Ags. Gram. ed. 3) as indicating that the word,
though recorded only as masculine, was originally a neuter -os, -es
stem: it would thus correspond formally to the Sanskrit word quoted
Wiktionary says Proto-Germanic *gaistaz is
From Proto-Indo-European *ǵʰeysd-, *ǵʰisd- (“anger,
agitation”), from Proto-Indo-European *ǵʰyis- (“bewildered,
frightened”), from Proto-Indo-European *ǵʰey- (“to propel, move,
spin”), from Proto-Indo-European *ǵʰī- (“to yawn, gape”).
I have no idea if all of this is correct. Note that even if it is, each root cited as an ancestor contains i or y.
According to the Online Etymology Dictionary, "guest" comes
from Proto-Germanic *gastiz (source also of Old Frisian jest, Dutch
gast, German Gast, Gothic gasts "guest," originally "stranger"), from
PIE root *ghos-ti- "stranger, guest; host" (source also of Latin
hostis, in earlier use "a stranger," in classical use "an enemy,"
hospes "host," from *hosti-potis "host, guest," originally "lord of
strangers;" Greek xenos "guest, host, stranger;" Old Church Slavonic
gosti "guest, friend," gospodi "lord, master")
Wiktionary agrees that Proto-Germanic *gastiz is from Proto-Indo-European *gʰóstis, which is says is
possibly from *gʰes- (“to eat”) (Sanskrit घसति (ghasati))
According to the Oxford English Dictionary, "guest" is from
Germanic *gasti-z < West Aryan *ghosti-s, represented also by Latin
hostis, originally ‘stranger’, in classical use ‘enemy’ (whence the
compound *hosti-pot-, contracted hospit-, hospes guest, host) and by
Old Church Slavonic gostĭ guest, friend. According to Brugmann, the
synonymous Greek ξ-ένος is < *gh's-, weak grade of the root *ghos- represented in the Germanic word.
According to phonetic law as at present understood, the initial consonant in the Old English word must have had a palatal pronunciation, which would normally yield Middle English ȝ, modern English y. No forms with ȝ or y are, however, known to exist; the abnormal guttural pronunciation is usually explained as due to the influence of Old Norse gest-r; but the occurrence of hybrid forms like gist, gust /ʏ/ in the S.W. dialects of the 13th cent. is hard to account for on this supposition.
My own thoughts
What follows is subjective and probably not that useful, but I'll try to summarize what I think.
It seems phonologically impossible for Modern English /goʊst/ to descend from Proto-Indo-European *ghosti-s/Proto-Germanic *gastiz (the root meaning "stranger"). The sound changes do not work out, in English or in any other languages from which English might have got this word as a loan. So even if the idea of a semantic change "stranger" > "ghost" seems plausible, this does not work as an explanation of the etymology of these words.
It seems a bit more possible from a phonological perspective for "guest" to have descended from Proto-Germanic *gaistaz or *gaistoz. This is not possible following regular English sound changes from Proto-Germanic, but we already know from the initial consonant that this word did not develop totally regularly in English, and that it may have been influenced by borrowing from other Germanic languages (some of which have "e"-like vowels in the descendants of *gaistaz). But the words in other Germanic languages that are descended from *gaistaz all basically mean "ghost." Semantically, there is not a good match between the meaning of "guest" and the meanings of other words believed to be descended from *gaistaz, and there is a very good match between the meaning of "guest" and the meanings of other words that are believed to be descended from *gastiz.
It doesn't seem particularly likely to me that a root originally meaning "to wound/tear apart" or "fury" (in Proto-Indo-European), and "ghost" later on (in Proto-Germanic), would then develop the meaning of "guest." Of course, many odd semantic changes are possible, and are postulated due to other convincing evidence of an etymological relationship between words, but there isn't any convincing evidence of a connection in this case.