There is no rule in a slalom or giant slalom that you want to hit those gates, but you have to pass between them on alternating sides, with the tips of both skis passing between the poles. The closer you get to the door, the more direct a route you are taking on the slope - which means a faster runtime.