This is a slang way of saying your body will hit the bed when you lie down.
During World War II, American soldiers started referring to their sleeping bags as ‘sacks.’ ‘Hit the sack’ replaced the earlier expression ‘hit the hay.’ Why hay? Early mattresses were just large sacks stuffed with something soft, like feathers or hay. Before people lay down to sleep, they pounded on the sack till the straw or hay was evenly spread. Hence the expression ‘hit the hay.’
The 'sack' as slang for bed has been around a long time. Besides ‘hit the sack,’ we use ‘sack time,’ and ‘sack out.’ ‘In the sack’ means ‘in bed,’ which has long been associated with sex. I don't think I need to elaborate on that!