The sentence has a pronoun reference error. 'The ship' is singular, but 'they' is plural. It should be 'it sailed in' to maintain subject-verb agreement. The correct phrase is 'The ship was caught in a storm as it sailed in along the coast of Japan'.