A general election four days later handed a landslide victory to Nawaz Sharif and his Pakistan Muslim League-Nawaz (PML-N).
But Khan's campaign electrified many, pushing his Pakistan Tehrik-i-Insaf (PTI) from a marginal party to the country's third-largest.
Khan walked out of hospital by a back exit, avoiding reporters, television said.
Khan has accused the Muttahida Quami Movement (MQM) of killing a senior PTI member on Saturday outside her home in the upscale Defence area of Karachi, capping a bloody election in which about 150 people were killed nationwide.
MQM leaders condemned the killing by unidentified gunman and demanded a retraction from Khan.