1660s, "period a ship suspected of carrying disease is kept in isolation," from Italian quarantina giorni, literally "space of forty days," from quaranta "forty," from Latin quadraginta"forty," which is related to quattuor "four" (from PIE root *kwetwer- "four"). So called from the Venetian policy (first enforced in 1377) of keeping ships from plague-stricken countries waiting off its port for 40 days to assure that no latent cases were aboard. Also see lazaretto. The extended sense of "any period of forced isolation" is from 1670s.
Earlier in English the word meant "period of 40 days in which a widow has the right to remain in her dead husband's house" (1520s), and, as quarentyne (15c.), "desert in which Christ fasted for 40 days," from Latin quadraginta "forty."