From our daily experience with nature, it does seem like nature abhors a vacuum. If you create a vacuum inside a container here on Earth, nature will fill the container with air very quickly if you give it the chance (for example, by puncturing the container).
On the other hand, we know that outer space is a giant vacuum. Outer space is infinitely larger than Earth, so 99.9999999...% of our universe is a vacuum. Based on this, it might be better to say that "nature loves a vacuum!" So why doesn't the vacuum of outer space suck away our atmosphere?
Say that you are standing on Earth holding a glass bottle. If you attach the bottle to a vacuum pump, pump out all the air and then seal the bottle, the bottle contains a vacuum. If you put a hole in the bottle, air rushes in. The reason it rushes in is because of the air pressure around the bottle. Standing on the ground, we are all standing in an ocean of air that rises many miles above us. The air molecules stack up on one another and create a pressure of 14.7 pounds per square inch (psi) at sea level. The higher you rise in the atmosphere, the shorter the stack of molecules, so the lower the pressure.
Air Pressure at Various Altitudes
- Sea level - 14.7 psi
- 10,000 feet - 10.2 psi
- 20,000 feet - 6.4 psi
- 30,000 feet - 4.3 psi
- 40,000 feet - 2.7 psi
- 50,000 feet - 1.6 psi
At sea level, it is the weight of all of the molecules stacked above the bottle (14.7 pounds of them in every square inch) that forces the molecules into a punctured vacuum.
If you were to travel in a rocket to the edge of the atmosphere, you would find that there is no air pressure. Instead, individual air molecules are zipping around in the vacuum of space. The molecules can zip anywhere they like, but they tend to zip toward the Earth because the Earth's gravity acts on them just like it acts on anything else with mass. The reason the vacuum of space does not attract the molecules is because there is no suction to the vacuum of space -- there is no air pressure forcing things into the vacuum. All there is in space is molecules traveling through the vacuum.
You can see that there is no danger of the vacuum sucking our atmosphere away, but it turns out there is another force that could strip away our atmosphere. That force is called the solar wind. Fortunately, the atmosphere is protected from the solar wind by the Earth's magnetic field.
These links will help you learn more: