Over time, the word evolved to *gæstlic*, meaning "ghostly" or "spectral". This eventually became the Middle English word *gastly* and later the modern English "ghastly."
Therefore, the word "ghastly" literally means "like a ghost" or "resembling a ghost". This explains why it's used to describe things that are frightening, pale, or generally unpleasant.