You need a gunner, ammo, cannons, be at the right range (most cannons have a minimum range as well as a max range) and you have to be facing the right direction (the guns are on the sides, not the front). Here's a video from beta showing a ship battle where he fires cannons. Footage was recorded during the Closed Beta!