According to the theory developed by C.C. Lin at MIT and Frank Shu at U.C. Berkeley in the early 1970's, the spiral arms of galaxies like the Milky way are produced by a gravitational disturbance in a thin disk of matter that is rotating according to Kepler's Laws. Each speck of matter in the disk is viewed as being in an independent orbit around the Galactic Center where most of the gravitating mass is located. Such a disk is subject to shearing because the orbital speed of particles decreases continuously from the center to the outer edges. This also means the angular speeds also vary as you move outwards in the disk.
Spiral density waves are produced in such a system as gravitational troughs caused by a gravitational instability in this rotating disk form, and rotate with a fixed pattern speed. At the inner edge of the disk, called the Inner Lindblad Resonance, the pattern speed equals the angular velocity of matter orbiting the center of the galaxy. This occurs about 2 - 4 kiloparsecs out from the center. There is also an Outer Lindblad Resonance where the pattern speed is the first harmonic of the speed of the orbiting matter. This is believed to be located near the edge of the optical disk of the spiral galaxy at a distance in the Milky Way of about 20 kiloparsecs.
As the gravitational wave pattern passes, it causes gas and dust clouds to fall towards one another, and presumably trigger star formation. The entire pattern of the instability in the disk is then instantaneously illuminated by the light of new born massive stars, and we see a spiral arm. As the wave moves on in its orbit around the center of the galaxy, other gas clouds and star formation activity occurs as matter follows the 'density wave'. Spiral arms are, therefore, not solid but are merely the locus in the galaxies disk where the spiral-shaped gravitational instability pattern happens to be located as it sweeps through the disk, and is momentarily illuminated by the star formation activity it triggeres as molecular clouds fall into the trough.
This is a crude description of the essential details. More can be found on this in the technical literature, as you can well imagine. Look in books on galactic structure and star formation theory.