This question already has an answer here:

The X-men time line is

  1. Wolverine Origins(2009)
  2. X-men: First Class(2011)
  3. X-men: Days of Future Past(2014)(Past Section)
  4. X-men:Apocalypse(2016)
  5. X-men (2000)
  6. X-men 2 (2003)
  7. X-men: The Last Stand(2006)
  8. The Wolverine(2013)
  9. X-men: Days of Future Past(2014)(Future Section)

Original Timeline is 5,6,7,8.

Then Wolverine is sent back in time in 9.

But before 9, at the ending of 8, Wolverine meets Xaviers(who was turned to nothing in 7) and Magneto(Who lost his powers in 7)

Magneto may have got back his power maybe through sheer will, or maybe the serum's effect wasn't permanent. But how did Xaviers came back? He only says to Wolverine that he is not the only one with special powers. But its never revealed how or who brought him back.

marked as duplicate by Adamant, Steve Harrington, Community May 25 '16 at 7:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.