It's because the hull of the ship passing through the water acts as a physical barrier blocking their passage and pushing large amounts of water away from the hull (bow wave). So by jumping out of the water, dolphins reduce the effects of the bow wave, allowing them to move more freely and continue their path.