Forecastle, also spelled fo'c's'le originally meant the upper deck of a sailing ship, forward of the foremast. The syncope of the word is common among nautical terms due to the nature of their pronunciation during the age of sail by sailors with strong accents and varying language skills.
The term "forecastle" relates to medieval shipbuilding, where ships of war were usually equipped with a tall, multi-deck castle-like structure in the bows of the ship which served as a platform for archers to shoot down on enemy ships and could also be used as a defensive stronghold if the ship was boarded.
Having such tall upper works on the ship was detrimental to sailing performance. As cannons were introduced and gunfire replaced boarding as the primary means of naval combat during the 16th century, the medieval forecastle was no longer needed, and later ships such as the galleon had only a low, one-deck high forecastle.
In addition to crew's quarters, the forecastle may contain essential machinery such as the anchor windlass. On many modern US Naval ships (such as aircraft carriers), the forecastle is the location where boatswain will display their fancy knotwork such as coxcombing.
Some sailing ships and many modern (non-sail) ships have no forecastle as such at all but the name is still being used to indicate the foremost part of the upper deck (although often called the foredeck) and for any crews quarters in the bow of the ship, even if below the main deck.