'Hatch' is one of those words with dozens of meanings in the dictionary. In this case we are looking at the 'opening in the deck of a ship' meaning. Ships' hatches, more formally called hatchways, were commonplace on sailing ships and were normally either open or covered with a wooden grating to allow for ventilation of the lower decks. When bad weather was imminent, the hatches were covered with tarpaulin and the covering was edged with wooden strips, known as battens, to prevent it from blowing off. Not surprisingly, sailors called this 'battening down'.
The above was explained, probably better than I just have, in the definitive record of history of nautical language, Admiral W H Smyth’s 1867 encyclopaedia The Sailor’s Word Book. He calls it 'battening of the hatches' but it is clearly the same expression:
“Battens of the hatches: Long narrow laths serving by the help of nailing to confine the edges of the tarpaulins, and keep them close down to the sides of the hatchways in bad weather.”