It is a contraction of the drinking salute "The cup that cheers" as in cheers you up. It becmae used as a general greeting in the second half of the 20th Century. Cheers as a word for cheeriness has a longer history, deriving from the old French for face ... be of good cheer = put on a happy face.