When the Galilean moons formed, they weren't in resonance with each other. All of them were in slightly smaller orbits than they are now. Over time after their formation, Io's orbit slowly moved outward due to tides from Jupiter. This is the same effect that is causing our moon to slowly move away from the Earth (at about the same rate your fingernails grow). It goes like this. The Moon's gravity causes tides to form in Earth's oceans. This bulge of water gets carried forward with Earth's rotation, because the Earth is spinning faster than the Moon is orbiting. Because the moon is still attracting the bulge, it causes a drag on the Earth, slowing its spin. At the same time, the bulge is attracting the moon, causing it to go faster in its orbit. As the moon speeds up, its orbit gets bigger. So essentially, the Earth's spin energy is getting transferred into the Moon's orbital energy. The same thing happens with Jupiter and Io, with a bulge in Jupiter's atmosphere causing Io's orbit to get bigger.
As Io's orbit expanded, its 'year' got longer, until it approached a 2/1 resonance with Europa. Once they reached resonance, they got 'locked in', their mutual gravity acting on each other reinforced it. Io was still raising tides on Jupiter, though, and its orbit was still trying to expand. As Io's orbit kept expanding, it gave a gravitational kick to Callisto on each pass, expanding both of their orbits until Ganymede reached a 2/1 resonance with Callisto. This is where the inner 3 Galilean moons got their resonance. The orbits are still expanding, but much more slowly because with each one you add on, it gets harder to transfer the energy. Given enough time, all 4 Galilean moons would probably reach resonance, although the sun will die before that happens.
I may have some of the minor details wrong here, but this is the story as I understand it.
EDIT: Seven years later, When will Callisto be in orbital resonance with the rest of Jupiter's big moons? was asked. The newest answer for when the first four moons will be in orbital resonance is much sooner than the Sun will die. Specifically, about 1.5 billion years from now.