"long pole on a ship, secured as the lower end to the keel, to support the yards, sails, and rigging in general," Old English mæst, from Proto-Germanic *mastaz (source also of Old Norse mastr, Middle Dutch maste, Dutch, Danish mast, German Mast), from PIE *mazdo- "a pole, rod" (source also of Latin malus "mast," Old Irish matan "club," Irish maide "a stick," Old Church Slavonic mostu "bridge").
The single mast of an old ship was the boundary between the quarters of the officers and those of the crew, hence before the mast "serving as an ordinary seaman" in the title of Dana's book, etc.
In all large vessels the masts are composed of several lengths, called lower mast, topmast, and topgallantmast. The royalmast is now made in one piece with the topgallantmast. A mast consisting of a single length is called a pole-mast. In a full-rigged ship with three masts, each of three pieces, the masts are distinguished as the foremast, the mainmast, and the mizzenmast; and the pieces as the foremast (proper), foretopmast, foretopgallantmast, etc. In vessels with two masts, they are called the foremast and mainmast; in vessels with four masts, the aftermast is called the spanker-mast or jigger-mast. [Century Dictionary, 1895]