In an interview with Empire Magazine, director Bryan Singer provided the back story that Magneto helped Wolverine.
He has his adamantium claws cut off at the end of The Wolverine, though…
The thing that happens at the end of The Wolverine involves just the claw part so I postulated that in the future he would reconstitute the adamantium claws because it’s part of his skeleton and he’s become accustomed to having that as a weapon. In the future, he has a different relationship with Magneto and perhaps one could forge that. These are extraordinary characters who can do things like teleport across large distances and walk through walls and change the weather. As long as Xavier’s consciousness still existed in that man at the end of X-Men 3, I consider the possibility that a mutant like Forge or even Xavier himself could reconstitute his body, so that’s how I justified bringing Patrick Stewart and Professor X back, and the same way I would justify bringing back the metal claws in the future is that that’s something he would want. At some point in his future he embraces what he is. At the end of The Wolverine, that’s a big part of that story. He goes, ‘I don’t need to be mortal, I’m settled being Wolverine’, and part of being Wolverine is the claws.
In the comics, it was Magneto who originally ripped the adamantium from Wolverine's body. Apocalypse re-bonds it after kidnapping Wolverine and turning him into Death, of the Four Horsemen.