From Ciardi’s A Browser’s Dictionary (1980):
Hip Mod. Slang (and prob. becoming passé). Aware, knowing, up on, in the know. [Earlier hep with the same senses, perhaps modified from the military usage for counting cadence, itself a modification of “left†as in hep-ri’-hep (because “hep†is easier to say with great expulsive force. MMM* attests hep in this military usage by 1862; with the sense “aware, knowing,†as of 1903; the sense shift being from military alertness to alertness in any sense.
Ciardi being Ciardi, that wasn’t enough information about the word. He added,
J.L. Dillard, Where Our words Come From,asserts a straight-line connection between West African hipi and mod. slang hippie; but this assertion addresses only the present form hip without considering earlier hep, it suggests no conceivable line of transmission, and must be dismissed as a fetch based on surface resemblance only by a Negro scholar who is a bit overzealous in his otherwise admirable desire to show how much Africa culture has contributed to American life—as it has done richly, though that contribution is not assisted by willful etymology.]
*(Mitford M. Matthews, A Dictionary of Americanisms on Historical Principles)