Gravity does affect electromagnetic radiation, including radio waves and visible light. According to the theory of general relativity, gravity is the curvature of spacetime caused by mass and energy. As light travels through curved spacetime, its path is indeed affected. This effect is known as gravitational lensing.
Gravitational lensing occurs when light passes near a massive object, such as a star or a galaxy. The gravitational field of the object curves the spacetime around it, causing the path of light to bend. This bending can lead to the apparent deflection or distortion of the image of a distant object.
However, in the scenario you described of stars moving through space at near-light speeds, there are a couple of factors that help explain why their direction is not significantly deflected:
Velocity and mass: When an object moves at near-light speeds, its mass and energy contribute to the curvature of spacetime. This means that the moving star itself creates its gravitational field, which interacts with the light it emits. The combined effect of the star's mass and its motion can compensate for the gravitational lensing caused by other objects, resulting in a relatively straight path for the light.
Relative motion: The motion of the star itself can have a relativistic effect on the light it emits. Due to time dilation and length contraction at high speeds, the star's emitted light can be perceived differently by an observer. This means that the direction of the light can appear altered to an outside observer, but it is due to the relativistic motion of the star rather than a gravitational deflection.
Overall, the combined effects of the star's own gravitational field, its motion, and relativistic effects help mitigate the deflection of light caused by gravity. However, in extreme scenarios with highly curved spacetime or massive gravitational sources, the deflection of light can still be noticeable, leading to phenomena like gravitational lensing.