The stretching out of the Earth’s magnetic field by the solar wind is not all that happens. If it was we'd all be perfectly safe.
The magnetic field in the solar
wind constantly changes direction. Sometimes
it is in the same direction as the Earth's magnetic
field, but sometimes it is directly opposite.
When they are facing in opposite directions,
the two fields often decide to interact with
each other. This is called magnetic
reconnection. The solar wind then pulls the
Earth's magnetic field with it and the magnetotail grows
even longer. This is a way of storing energy,
and a way of storing up trouble for the Earth.
When the solar wind stretches the magnetotail in this way, it's a bit like stretching an elastic band - lots of energy from the solar wind is transferred to the magnetic field. If the magnetic field is suddenly released because of a change in the solar wind then - ping just like a catapult, energy is released and is used to accelerate particles back towards the Earth.
Here’s another picture that shows the effect of those energetic particles that end up streaming back towards the Earth.