In the following sentences, I am curious about what it represents.

Can you give me the answer?

I think IT means "a route," but 'an oncoming vehicle' looks fine.

Can you tell me which one is right and why?

The hairpin turn is a bend in a road with a very acute inner angle, making it necessary for an oncoming vehicle to turn almost 180° to continue on the road. Hairpin turns are often built when a route climbs up or down a steep slope, so that it can travel mostly across the slope with only moderate steepness, and are often arrayed in a zigza] pattern.
This isn't an example of good writing. I'd say IT refers to "route" which is used here as another word for "road." Obviously, a vehicle, not the road, "travels." But there's nothing here to suggest "a vehicle" as the antecedent, rather than, let's say, a donkey.

We also call these "switchbacks," especially when referring to mountainous footpaths.
Students: We have free audio pronunciation exercises.
Thanks, Avangi.
Hi Stenka, Re-reading this after a few days away confirms that the author thinks of the route (or road) as "travelling mostly across the slope." He previously makes the metaphor even more explicit by saying "when a route climbs up or down a steep slope."

(Let's forget about the donkey.)