Rendering fog underneath water
You can ray trace the distance to the second surface. This may be conceptually easiest, but not necessarily fastest method*.

But there is a neat trick, you can multi pass render a depth map to the water surface from the camera. The distance in water is now pixel depth minus the depth map depth. This does not work in all situations such as when you exit water and re-enter later. But should work in many cases, like the one depicted. You can even use same technique for Boolean operations.



Image 1: Render depth map, consult depth map when shading the bottom of your pond.

* It might be in certain cases.