During battle, your ship will take damage. Take enough and you're sunk. Luckily, there are several ways to repair your ship.
Consumables:
There are numerous consumables that can be used to repair your ship. There are many ways to obtain them as they can be made by players, purchased through the auction house, received as rewards for missions, taken from npc ships you defeat in battle, and traded for from the fish monger.
Skills:
These are specific to your character class and learned as skills while you level up.