"Sailors and cats have a special relationship that dates back thousands of years. It is likely that the ancient Egyptians were the first seafarers to realize the true value of having cats as shipmates. In addition to offering sailors much needed companionship on long voyages, cats provided protection by ridding ships of vermin. Without the presence of cats, a crew might find their ship overrun with rats and mice that would eat into the provisions, chew through ropes and spread disease. The more superstitious sailors believed that cats protected them by bringing good luck. It was also common for crews to adopt cats from the foreign lands they visited to serve as souvenirs as well as reminders of their pets at home."
Read more at U.S. Naval Institute