Walking on the sand of the beach is walking on a very unstable surface and works the leg muscles in a way that walking on pavements do not. If you want to strengthen your leg muscles and your back…go walk on a sandy beach barefoot. People who live in Hawaii and go to the beach regularly, have very strong and healthy legs..
My guess on why you send people to the ocean - when you are standing in the waves at water's edge, it's activating the proprioceptive system and you (subconsciously for most folk) begin to reset your awareness of balance and position as the sand shifts under your feet with the in and out of the waves. (0 comments, so I hope I'm right!)