The use of the term "head" to refer to a ship's toilet dates to at least as early as 1708, when Woodes Rogers (English privateer and Governor of the Bahamas) used the word in his book, A Cruising Voyage Around the World. Another early usage is in Tobias Smollett's novel of travel and adventure, Roderick Random, published in 1748. "Head" in a nautical sense referring to the bow or fore part of a ship dates to 1485. The ship's toilet was typically placed at the head of the ship near the base of the bowsprit, where splashing water served to naturally clean the toilet area.
Other maritime uses of the term refer to the top or forward part, such as the mast (top of the mast/masthead), and the top edge of a sail, as well as the compass direction in which the ship is pointing, etc.
Source of Information:
Kemp, Peter. The Oxford Companion to Ships and the Sea. (New York: Oxford University Press, 1976): 381.
Oxford English Dictionary. vol.5 (New York: Oxford University Press, 1933): 142.
Partridge, Eric. A Dictionary of Slang and Unconventional English. 8th ed. (New York: Macmillan, 1984): 540
The Visual Dictionary of Ships and Sailing. (New York: Dorling Kindersley, 1991): 16.