He formulated the law of universal gravitation, which states that every particle of matter in the universe attracts every other particle with a force that is proportional to the product of their masses and inversely proportional to the square of the distance between their centers.
This force, called gravity, is what keeps planets in orbit around the Sun and the Moon in orbit around the Earth. Without gravity, planets would indeed fly off in straight lines.