Basically I think Chewbacca was an Imperial prisoner, Han was either training in an Imperial Academy or teaching there, and several Imperials were abusing the non-human slaves. Han stood up to them, helped free Chewie and they escaped together in a shuttle. The saving of the Wookiees life caused him to pledge a life debt to Han, which is why they were always together, even in the face of certain death. However, over many years the two became friends to such an extent that I personally think Han mourned more for Chewbacca's death than he did his own son, Anakins.
For further information, see the Star Wars Wiki, wookieepedia.