Given: The speed of light in space is a constant; it does not vary (proven).
Given: Time near a large mass (e.g. Earth) is slower than time further away from a large mass (proven).
Given: velocity = distance traveled / measured time.
Therefore distance traveled by light must change with a change in measured time.
A clock on a GPS satellite is about 500 picoseconds faster per second than a clock on Earth (the Special Relativity effect of the satellite's velocity through space is removed from this time). That's 1/50,000,000,000th of a second. The speed of light is about 300,000 meters per second. So the linear change in space on Earth will be about 300,000/50,000,000,000 of the linear distance of the space at the GPS satellite orbit or 3/500,000 meters or 0.000006 meters smaller. See Time Dilation/Gravitational Time Dilation on Wikipedia.
Since we know that time near a large mass is slower, and the speed of light is the same near a large mass as it is further away, then space near a large mass is contracted. Obviously mass affects spacetime, which causes "gravity." How mass affects spacetime is unknown.
BUT, don't talk to an astrophysicist about space expanding or contracting! Use the term "space metric." They don't like to think about empty space doing anything, although the "space metric" can change to account for the constant speed of light (see Metric tensor (general relativity) in Wikipedia).
Electromagnetic waves (photons (light, for example)) bend closer to a large mass as they travel through space because they have energy, and Einstein's General Theory of Relativity formula includes energy in its stress-energy-momentum tensor. The General Theory of Relativity explains how spacetime causes "gravity" in extremely complex mathematical terms. Einstein used the term spacetime because he combined the 3 dimensions of space with time to come up with his mathematical formula for the General Theory of Relativity. Since he characterized spacetime as 4-dimensional, he said that spacetime "curves" more nearer a large mass. This is equivalent to saying space contracts while time slows near a large mass. Either visualization works.
Astronomer Edwin Hubble famously declared in 1929 that only the continuing expansion of space itself could account for the fact that the further that light had to travel from distant stars/galaxies, the greater the red-shift of light (Hubble's Law). Red-shift refers to the fact that even though light always travels at a constant velocity, its energy (measured by its wavelength/frequency) decreases as space expands. It's also true that light is red-shifted as it travels away from a large mass (like Earth), or blue-shifted as it travels closer to a large mass.
You can visualize light being red-shifted with space expansion by imagining a string in the form of a sine wave beginning at point A and ending at point B. If you move point B further from point A (space expanding), the sine wave will have a longer wavelength, which, if the sine wave represented a color, would change in the direction of the red end of the color spectrum.
The current thinking about the origin of the Universe (the Big Bang) is that space first expanded explosively (see Inflation (cosmology) in Wikipedia), and then began decreasing that expansion rate. The effect of mass on space seems to account for the decrease.
MAYBE the Big Bang resulted from the previous mass in the Universe coming together to form the ultimate black hole, which then turned into the ultimate pure energy, which allowed space and time to fill out explosively (much faster than the speed of light) from zero space and zero time (since there was no mass to act on space and time). Because of the expansion of space, the ultimate pure energy began cooling and turning back into all the mass in the Universe, which then began slowing that expansion of space.
MAYBE the expansion of space is accelerating even more now because of the decreasing effect of mass on it. If space initially expanded in the Big Bang because no mass was affecting it, then space would accelerate its expansion again due to the total density of mass decreasing in the Universe (caused by space's expansion). HOWEVER, because of how the total density of mass in the Universe has been calculated, this isn't possible, so Dark Energy is used to account for the accelerated expansion. Ugh.
MAYBE, if spacetime's expansion finally slows enough, then this might lead to the beginning of a slow contraction of space since mass would still act on space if only very slowly. This would lead to my first MAYBE.
Finally, MAYBE the way a change in spacetime causes "gravity" is that while electrons are "spinning" around an atom's nucleus at near the speed of light, the part that's closer to a large mass either has more energy or more time to get from where it was to where it's going or less distance to travel than the part away from the large mass, so they try to pull their atoms that way.
Magnetism is very similar to gravity, but it needs a moving electrical charge, along with the Special Theory of Relativity, to exist (electrical charges travel VERY fast). Relative motion at relativistic speeds causes an "apparent" change in positive/negative charge (number of electrons vs. protons "seen" at any one time). Permanent magnets exist because all the electrons in a permanent magnet are oriented in the same direction, i.e. their electrical charges are all "spinning" in the same direction (VERY fast). I quotize spinning because physicists prefer to think that they simply have angular momentum, and use the term spin in a different way. So magnetism is simply the name given to how VERY fast moving or "spinning" electrons along with the Special Theory of Relativity affect other electrons. In this way, it's like the term "gravity."