Ghastly
Middle English: from obsolete gast ‘terrify’, from Old English gǣstan, of Germanic origin; related to ghost. The gh spelling is by association with ghost. The sense ‘objectionable’ dates from the mid 19th century.
wiktionary
From a conflation of a derivation of Old English gǣstan(“to torment, frighten”) with the suffix -lic, and ghostly (which was also spelt "gastlich" in Middle English). Equivalent to ghast/ gast + -ly. Spelling with 'gh' developed 16th century due to the conflation.
etymonline
ghastly (adj.)
c. 1300, gastlich, "inspiring fear or terror, hideous, shocking," with -lich (see -ly (2)) + gast (adj.) "afraid, frightened," past participle of gasten "to frighten," from Old English gæstan "to torment, frighten" (see ghost (n.)). Spelling with gh- developed 16c. from confusion with ghost. Middle English also had gastful in the same sense, but this is now obsolete. Sidney and Shakespeare also used ghastly as an adverb. Related: Ghastliness.