Harry Potter deduced that the true owner was in fact Draco Malfoy -- before Dumbledore died, Malfoy had disarmed him and unknowingly won possession of the wand. Nearly a year later, Harry disarmed Draco and unknowingly became the wand's master.

When Voldemort used the Elder Wand to perform the Killing Curse on Harry, the wand refused to harm its true master, and instead the curse rebounded on Voldemort, finally killing him. Harry, now the true Master and owner of the wand, used it to repair his first wand. He then returned it to Dumbledore's tomb.

If Harry dies naturally, then the power of the Elder Wand, whose master would not have been defeated in battle, will then be nullified.
“I’m putting the Elder Wand,” he told Dumbledore, who was watching him with enormous affection and admiration, “back where it came from. It can stay there. If I die a natural death like Ignotus, its power will be broken, won’t it? The previous master will never have been defeated. That’ll be the end of it."