It used to take two days because they would launch way behind the ISS in their lower and faster orbit and then gradually catch up with it over a couple of days - called “phasing”. It’s a matter of timing, if you take two days to get there, you have much more time to do all the maneuvers needed to get exactly to the ISS. Nowadays they usually launch at just the right moment to fly all the way to the ISS within a few hours. But they can still do the older phasing approach as they have enough supplies on board to do it, for instance if the spacecraft misses out one of the automatic burns needed to get to the ISS in only six hours, see Soyuz Capsule with 3-Man Crew Taking Long Road to Space Station After Delay