The short answer is that it the expansion of the universe is not what makes space a vacuum. What we call a vacuum in outer space is actually caused by gravity.
And when we say, ‘outer space’, it refers to the whole area of space that is not considered the atmosphere of planets or stars. And when we say, ‘what we call a vacuum’, we mean that outer space is not actually a perfect vacuum or even completely empty.
Outer space is not completely empty because there are still places where there will be gas, dust or even gravity present. Even if you experimented with sucking a box of its air until it was completely empty, there would still be gravity present. And gravity, as a force, is present in all particles of matter.
They all exert gravitational attraction on other things, and have the same effect exerted on them. This even goes for tiny miniscule particles, gravitational force can be small or weak, but it will not be zero on these particles.
This is exactly how the theory of the Big Bang came to be: the idea that even the smallest particles can have gravitational force means that a cluster of gas will accumulate thanks to the gravitational force the particles exert on one another, as weak as it may be.
After the Big Bang occurred, outer space was filled with the gases: hydrogen and helium. These are the building bricks of today’s universe and went on to become stars thanks to the same gravitational force.
This succession from helium and hydrogen to stars creating other heavier elements, and those heavier elements being drawn together to create asteroids, planets and moons, has gone on since the Big Bang.
And now, gravity acts upon these larger entities since most of the original hydrogen and helium has been used up to make stars etc. thanks to the gravity that undoubtedly exists in outer space. If this gravity did not exist in outer space, and it was completely empty, there would be no planets or moons that were created with the help of gravitational pull.
Outer space itself, not including planets’ atmospheres etc., has a low density and low pressure. Because of this, it is close to being a perfect vacuum, but it will never truly be a perfect vacuum, it is just easier for us to say that it is a vacuum.
So, the expansion of the universe does not cause outer space to be a vacuum, because this expansion can only really be observed in the distances between galaxies. When you compare these findings of expansion to particles within a galaxy, they are not the same.
This is because the gravity acting on particles within a galaxy, in the human body for example, are bound in too strong a way to be affected by the universe’s expansion.
Meaning that the expansion occurring in the universe as a whole is not the cause of outer space being a vacuum. The gravitational forces that surround the atoms in our body, and the planets in our solar system, and even the moons of those planets, are too strong to be affected by the expansion of the greater universe, so our galaxy is safe from expansion.
But it will become distanced further from other galaxies thanks to expansion, since the space that spans between galaxies is sparser in terms of gas, dust and gravity. So, expansion is more likely to affect those areas of outer space.