When going to sea, early sailors had to provide for their own bedding.
This need was catered to by merchants on the docks who, for a shilling, sold the seamen crude canvas sacks stuffed with hay.
When heading off to sleep, a sailor would announce that he was going to “hit the hay.”
Although less crude than those coarse canvases, early North American settlers also used hay to stuff mattresses and pillows, so when going to bed, they too would “hit the hay.”