Depression does dramatically affect the hippocampus, which of many things, controls memory. Then you add in the lack of focus which also affects your ability to create permanent memories. In short, yeah, sever depression and some mental illnesses can have an affect on memory, worsening with time. I remember very little of my childhood or adulthood. Then again, to be fair, I have done very little worth remembering.
I believe some antidepressants have the added benefit of neurogenesis which helps counteract atrophy of the hippocampus, but I am not a doctor, but instead a professional dumbass, so do your own research.