It is important to note that rectilinear propagation is only an approximation. The rectilinear approximation is only valid for short distances, in reality light is a wave and have a tendency to spread out over time. The distances for which the approximation is valid depends on the wavelength and the setting being considered. For everyday usages, it remains valid as long as the refractive index in the medium is constant.