Just like the first idiom, the literal meaning of this would be physically hitting or beating a sack (a large bag usually used for carrying things in bulk such as flour, rice or even soil). But actually to hit the sack means to go to bed, and you’d use this to tell your friends or family that you’re really tired, so you’re going to sleep. Instead of saying hit the sack you can also say hit the hay.

“It’s time for me to hit the sack, I’m so tired.”