Maintaining hygienic practices on a pirate ship was an uphill battle. Lack of access to clean water, combined with confined living spaces, led to the rapid spread of disease. Harsh elements and inadequate nutrition further contributed to generally poor health. Baths, laundry, and oral hygiene were at a minimum, even with a somewhat surprising amount of medical resources.
Pirate ships were dirty - there's no way around it. The life of a pirate was fraught with danger and disease, but the pirates themselves did find ways to clean themselves and their surroundings - at times.