In the screenshot of your Ocean modifier you have Resolution Viewport set to 20 but Resolution Render, just below, set to 2. The Resolution settings determine how many levels pf subdivision are present in the final result. In ‘preview’ mode the resolution of 20 is giving enough detail to be able to see the ripples but in Render mode you’re effectively just seeing a flat surface. Increase the Render resolution to match the Viewport resolution.