This is a complex topic that I can only brush the surface of here. You may try doing some research on your own to delve deeper into the topic.
In classical Newtonian physics, space and time were independent. Space was the 3-dimensional geometry that contained all of the matter and energy in the universe. Time ticked on at a constant rate independently of space or an observer's state of motion. In the late 1800s, the Michelson Morley experiment seemed to show that the speed of light did not vary with the observer's state of motion, a result that contradicted the addition of velocities. Einstein was able to show in his Special Theory of Relativity that the speed of light in a vacuum is the same for all observers regardless of their state of motion. Since velocity is distance divided by time, the only way the speed of light would be the same for all observers is that the distances and times would NOT be the same for observers in different states of motion. Hence space and time were not constant, but varied with the observer's state of motion; and they varied in a coordinated way to keep the speed of light constant for everyone. Another physicist, Herman Minkowski, combined space and time into a single 4 dimensional quantity called spacetime. While two observers moving wrt one another would NOT agree on the distance and time between two events, they would agree on the 4 dimensional spacetime distance between the events. Later in his General Theory of Relativity, Einstein showed that the presence of mass or energy warped the geometry of spacetime, resulting in what we call gravity. So not only are space and time related, but they are also impacted by the presence of matter and energy. Clocks on Earth, for instance, run more slowly than clocks in free space. GPS sattelites have to have their clocks re-synced regularly with clocks on Earth due to this effect.
For more info on Length Contraction and Time Dilation, check out the following website:
http://hyperphysics.phy-astr.gsu.edu/hbase/Relativ/tdil.html