Shortly after the shuttle clears the launching tower, the software of its automated guidance, navigation, and control system initiates a roll command to line it up on the desired course and heading.
The roll program tells the engine nozzles how much to gimbal, or swivel, to aim the shuttle properly. It goes straight up for only a short time, then rolls to take advantage of Earth’s rotation under it to get into orbit.
The shuttle goes downrange to get into orbit, actually heading downrange much faster than it goes up in altitude.
As for catching up to the space station, it is useful to consider the analogy of runners on a track. The station is in the outside lane, its orbit 240 miles above Earth, where it takes 92 minutes to go around the world at 17,500 miles an hour.
The shuttle, in the inside lane at a lower altitude, takes only 90 minutes a lap. Over two days, its altitude is slowly raised until it matches that of the station.
With both vessels traveling at the same orbital speed, the impact speed is about an inch per second.