From: Irregular Webcomic!
2012-12-31 Rerun commentary: This always bothered me. Hoth and Bespin are presumably in different star systems – and official Star Wars canon confirms this is the case. So with the hyperdrive offline, it should take years at sublight speeds to travel from one to the other. What actually happens is not explained in the movie, and is left to other sources.
Many fans have speculated over the years on how to fill this plot hole. Some like the explanation that the systems are actually very close, and it takes maybe a year or so for the Falcon to fly to Bespin. Although we don’t explicitly see that much time passing, it does provide plenty of time for Yoda to train Luke up on Dagobah – a much more realistic time than the few days that it seems like in the movie. It also gives plenty of time for Vader and Boba Fett to set up on Bespin in preparation for Han’s arrival, and plenty of time for a slow-burning romance between Han and Leia to develop. (Pity the Wookiee trapped on the ship with them.)
But the closest thing to a canonical explanation is given in Star Wars: The Essential Atlas, which states that Hoth and Bespin are some number of light years apart, and that the Falcon made the trip using its backup hyperdrive. This mysterious backup hyperdrive, which is not mentioned in the film, supposedly allows them to travel in hyperspace, but at a much slower effective speed, so the trip actually takes them a few weeks. This still gives Vader and Fett plenty of time to get to Bespin ahead of them, and it sort of gives Yoda a reasonable amount of time to exercise his Mr Miyagi skills on Luke.
Altogether it seems the most satisfactory explanation, apart from the fact that no backup drive is ever mentioned in the film.