The high-speed projectile moving near the sea level will significantly suffer from the effects of waves. The water entry and exit of a high-speed projectile crossing a wave are investigated by detached-eddy simulation. Three simulations with different altitudes through the wave are conducted to analyze the altitude's influence on the cavity dynamics. To validate the numerical model, a water-entry experiment is carried out in a wave tank for comparison. The projectile crossing the wave forms a cavity channel from water entry to exit. Because the water below the cavity is more difficult to displace than the atmosphere with the water surface under the cavitation effects, the downward expansion of vapor is blocked, and the wave surface is lifted. Consequently, the cavity above the projectile expands more strongly until breaking through the water surface, while the cavity below the projectile keeps closed, and the projectile is wetted. Thus, a nose-up pitching moment is generated at water entry, while the drag force is gradually enhanced during the water exit, and a lift force acts toward the atmosphere. As the altitude increases, the upper cavity becomes more open, but the lower cavity shrinks, leading to the augmentation of the lift force.