Aizen stole the Hollowization device and messed around with it.
Urahara knows how it works so he uses what he knows for a rough Vizardification on the Hollowed Shinigami, bringing them to Vizard form. He has them leave for their own safety while he tries to plea bargain.
Mayuri knows that Urahara made the device and sells him out. Aizen, realizing that without evidence Urahara could talk his way out of it, replaces the Hollowization device.
Urahara gets cursed to never re-enter soul society, none of his subordinates get the blame but, knowing where the real good guy is, they follow Urahara.
Urahara meets up with the outcast Vizard and they deal together to work to defeat Aizen. Zoom ahead 100 years and there you go.