Although fallen out of common usage, one definition of a sack is a bed. Early mattresses were often made from a cloth sack stuffed with hay, hair, or some other form of padding. In fact "sack out" is defined as "to go to bed, to go to sleep".
As for the 'hit' element in this sense, phrases such as 'hit the road', 'hit the trail' etc started to appear as American slang in the late 1800*. '*** the hay', meaning 'go to bed' - as explained by Clanad above - first appeared in print in 1912. 'Hit the sack' is a relative newcomer, no record of it existing prior to the early 1940s.
Aw for goodness' sake...this is absurd! After the final '0' in '1800' I typed the letter 's' to indicate plural; that is '1800s'. Then I typed the word 'hit'. This, of course, gave a forbidden 4-letter letter-sequence. Why on earth do the powers-that-be here persist in actually drawing the attention of the youngsters they imagine they are protecting to such things? The innocent would never have noticed the supposed profanity but for the asterisking!
QM, my sympathies. Many of us have had problems with the Asterisk Monster in the past, but this really takes the biscuit! I suppose we should be grateful that the word "sack" got through unscathed...