Indy lashed himself to the persicope with his whip and he rode it through the waves. The boat never went below periscope depth.
Seriously. It is described at length in the novelization.
They actually filmed Indy on the scope at sea for the montage of the sub traveling to the nazi base. But they never used the footage.