That is not caused by an earthquake...
In summers its hot. Metal expands. If there is no gap between rail segments, or no rail segments at all, the metal will start pushing against the other metal. So the rail will try to push forward, but can't. So it will go the only other way it can go. Sideways.