To form the imperfect tense, you take the -nous form of the present tense and remove the -ons ending. You then add the following endings depending on the subject.
je = ais
tu = ais
il/elle/on = ait
ils/elles = aient
nous = ions
vous = iez
For example, I was asleep when she came home = Je dormais quand elle a rentré