If you work outside the UK, you and your employer, or the person paying your wages, must pay Class 1 contributions if:
in the UK and was intended to be carried out either wholly or partly during the ship’s voyage
and
If, in the above circumstances your employer, host employer or the person who pays your wages does not have a place of business in the UK, but the shipowner or managing owner does, and you work as a master or crew member, you are personally responsible for paying your Class 1 contributions direct to HMRC.
The exceptions:
The UK has entered into agreements to improve the Social Security position of people who move between States to work. The agreements can sometimes vary the normal National Insurance rules for foreign flagged ships.
Vessels flagged in Reciprocal Agreements (RAs) and Double Contributions Conventions (DCCs) countries