There are millions of people around the world without access to drinkable fresh water. At the same time, the world's oceans contain more than 1.3 million cubic kilometers of salt water. Seems like all we have to do is get the salt out of the water, and we're all set. Unfortunately, thermodynamics makes this tough. Imagine that you have a tank full of sea water and magical filter that lets water through but blocks the dissolved salt ions. You could drag the filter across the tank - this would concentrate the salt in one side of the tank and leave behind fresh water. However, this takes work. You can think about the dissolved ions as a dilute gas, and when you're dragging the membrane across the tank, you're compressing that gas. An osmotic pressure would resist your pushing of the membrane. Osmotic effects are behind why red blood cells burst in distilled water and why slugs die when coated with salt. They're also the subject of a great Arthur C. Clarke short story.
In the language of thermodynamics, desalination requires you to increase the chemical potential of the dissolved ions you're removing from the would-be fresh water, by putting them in a more concentrated state. This sets limits on how energetically expensive it is to desalinate water - see here, slide 12. The simplest scheme to implement, distillation by boiling and recondensation, requires coming up with the latent heat of the water and is energetically inefficient. With real-life approximations of the filter I mentioned, you can drive the process, called reverse osmosis, and do better. Still, the take-away message is, it takes energy to perform desalination for very similar physics reasons that it takes energy to compress a gas.
Interestingly, you can go the other way. You know that you can get useful work out of a gas reservoirs at two different pressures. You can imagine using the difference in chemical potential between salt water and fresh water to drive an engine or produce electricity. In that sense, every time a freshwater stream or river empties into the ocean and the salinity gradient smooths itself by mixing of its own accord, we are wasting possible usable energy. This was pointed out here, and there is now an extensive wikipedia entry on osmotic power.