The reason for this is that the gate system is programmed to send people to the nearest gate when a problem occurs. So the traveler goes through the gate nearest the solar flare. SG-1 was leaving Earth when a flare erupted from our own sun. So the gate system sent them to the nearest gate, the same one they entered. In the case of Sheppard's trip, the flare occurred at his destination, so that is the gate he was sent to.