There's no part of a ship known as the "body." Masts are installed (shipbuilders say "stepped") in one of two ways:
Keep-stepped masts are mounted on the (wait for it...) keel of the vessel. There needs to be a hole in the deck(s) for the mast to go through, with the attendant issues of waterproofing, and designing the interior around the mast. You don't see this too often in modern boats.
Deck-stepped masts are mounted on the deck or cabin top, depending on the design. Usually, there's a compression post in the cabin that goes from under the mast to the keel to transfer the load off the deck. Aside from avoiding the waterproofing issues, the compression post can be smaller in diameter than the mast, and/or buried in a bulkhead, so interior design is less of an issue. The designer may also use a structural member in the deck or cabin top that transfers the load of the mast to the hull without a compression post.
In either case, the bulk of the strength of the mast comes from the standing rigging (stays and shrouds) that support it. The mast step just needs to be strong enough to support the weight of the mast and the downforce of the standing rigging.