Sharing past exam papers with friends I am a PhD student and we have a whatsapp group with all previous students from over the years. 

I was trying to earn some good karma and offered to provide past exams. 

I was always frustrated when other students didn't have them so I decided to provide them for free. 

I, unfortunately, sent them from my university email account and I now have a potential misconduct charge. 

Any advice?
If anyone notices then you may be in trouble. You will have to deal with that if it occurs. Since you are "guessing" then it may not be clear that any actual rule, as opposed to an implicit expectation, was violated. 

However, it would be helpful to your university for the future to clarify policies in writing. My suggestion would be that the policy make clear that all old exams are explicitly open for use and study. The opposite policy/assumption seems unrealistic in the extreme. Professors will need to deal with the fact that giving an exam is like "publishing" it and adapt future exams accordingly. 

I note that a number of universities do, in fact, treat old exams as if their contents is available and well known. It makes the professor's job just a bit harder, but, again, the opposite assumption assumes they are a bit lazy in coming up with ways to determine the knowledge of their students. 

There are also universities that would treat such things as a serious violation. Some of those, and I would hope all, ask the students to formally sign an Honor Code, listing what is allowed and what is not. Violations are serious, but there is clear notice at the beginning of the course of study. 

If you want to short circuit any sanction, though what I suggest is a bit risky, I realize, you could bring up your actions to the faculty on your own and suggest that the policy be clarified if necessary. If the policy wasn't clear to you ("I'm guessing...") then it isn't clear to others. This disadvantages some students in a way that can easily be avoided. 

But it also sounds like your university has a permissive policy about exams, from your statements about the library. If there were "violations" it would seem to me to be those of students who would remove materials so that they aren't available to others. 

But you will need to asses the risk of coming forward unbidden.