1650s, "mop made of rope or yarn," used for cleaning the deck of a ship, etc., from swabber (c. 1600) "mop for cleaning a ship's deck," from Dutch zwabber, akin to West Frisian swabber "mop," from Proto-Germanic *swabb-, a word perhaps of imitative origin and denoting back-and-forth motion, especially in liquid.
Non-nautical meaning "anything used for mopping up" is from 1787; as "cloth or sponge on a handle to cleanse the mouth of the sick, etc.," from 1854. The slang meaning "a sailor" is attested by 1798, is short for swabber "member of a ship's crew assigned to swab decks" (1590s), which by c. 1600 was being used in a broader sense of "one who behaves like a low-ranking sailor, one fit only to use a swab."