The typical extinction for a line of sight out of our Galaxy (but avoiding the Galactic plane) is of order a few tenths of a magnitude at visible wavelengths (it is a factor of 10 less in the infrared and factors of a few more in the UV).
This means that the typical attenutation of a signal arriving at the HST from outside the Galaxy is around say $10^{-0.2/2.5} = 0.83$ i.e. 83% of the light gets here.
Of course if you observe in a direction such that the light path travels in the Galactic plane, then the the extinction is much higher and does stop you seeing extragalactic objects (or even objects on the other side of our Galaxy).
In the intergalactic medium the attenuation is much lower, because the density of material (atoms, molecules etc.) that might absorb or scatter the light is also much lower -- typically $10^{-7}-10^{-6}$ H atoms per cc, compared with perhaps $10$ H atoms per cc in the Galactic interstellar medium (in the Galactic plane).
This in itself is not an explanation for why light isn't absorbed/scattered, since light travelling into the Galaxy might encounter a column density of H atoms of $10^{19}$ to $10^{20}$ cm$^{-2}$, but even at the very low IGM densities, similar columns could be reached over distances of tens or hundreds of millions of light years.
I think the principle reason is that the dust that is mostly responsible for blocking visible light is even less common with respect to gas in the intergalactic medium than it is in the interstellar medium. The dust is produced by stars and supernovae within galaxies, and although some of it does escape into the intergalactic medium, there is very little. Observations of type Ia supernovae at different redshifts suggests that the extinction due to intergalactic dust is less than around 0.1 mag for photons travelling from redshift of 0.5 (about 5 billion light years away) and that the dust-to-gas ratio is only a hundredth of the Galactic value (Inoue & Kamaya 2003).