Ghost is cognate with German Geist. The -h- was introduced by Caxton, who was influenced by Flemish spelling. In later English it might have been preserved by association with ghoul, which comes from Arabic and actually has a GH sound.