Both works just fine, such as in the lungfish. As you may guess, the lungfish is so called because it has lungs. It can breath air just as well as breathing water. This gives the hippocampus the ability to breathe in water and out of water, which can be a huge advantage! This is a great benefit for many organisms; if your water dries up, that's okay because you won't suffocate. If the water is hostile, due to predators or some other situation, you can just drag yourself onto land and can stay there for a while.
One Set of Legs?
Most biologists actually think that legs evolved from fins, which were used to provide a little boost to shallow- water dwelling creatures. A hippocamp may use these legs because they provide a boost in shallow water, help it lug itself out of the water (like seals do), or maybe even allow it to manipulate some things underwater. I'm not really sure where they are supposed to live, or what they eat, so I can only speculate on the uses of them.
It seems that their bodies would really work for surface swimming, because the horse legs don't have the kind of range of motion that you see in seals or manatees. It really seems like they need to tuck those legs in somehow, or just use them to keep their heads above water and use their fish-ends for actual locomotion in water. In any case, the hippocamp seems like a more realistic fantasy creature.