Simply he sucked out the demon out of whitebeard before the demon left whitebeard's body. His devil fruit powers allow his to suck the devil's powers out of a person. Why everyone says he ate 2 devil fruits doesn't agree with me. Either way whatever happened inside the curtain of black beard and white beard is the same or another story. Blackbeard has his darkness fruit and has held the earthquake demon hostage. ( As many rumors say as I agree with. With the victory of the payback war. Blackbeard sucked the devil fruit demon of Jozu to Shiliew. As a key rival to Zoro.