The theory of general relativity was developed by Albert Einstein in the early 20th century to explain the behavior of moving objects in space, after the discovery that the speed of light was always the same no matter how the person measuring it was moving.