In X-Men: Days of Future past, the timelines between the war future and the end-of-the-movie future begin to diverge when Wolverine wakes up in the past and begins meddling with things, such as recruiting Professor X and Beast to help him, who in turn know of Quicksilver who breaks Magneto out of prison.
With this in mind, in the original timeline Magneto remained in prison in the Pentagon, but at some point was either rescued or released before the events of the original X-Men film.
Is there anything which could explain how he got out of the Pentagon's prison?