It was said by sailors when they were drinking together. A "hatch" is the opening that leads to the part below the deck: to go below the deck you would need to go "down the hatch." In the drinking idiom, the hatch is compared to the mouth, and so you would throw the drink "down the hatch" into your belly.