Natural talent was obviously a factor, but so was the hard work and practice that they got at ages much younger than most of their peers. Both JC and MJ spent their teens practicing when others were playing. It wasn't forced, it was what they wanted to do.
I learned to code pretty much the same way. I'm no John Carmack, but when my peers entered college and were just starting to learn Java, I had been building games and weird little projects in C++ and Java for like 6 years. I naturally had an edge after that.
Finding what you love to do early in life and practicing that like crazy is a rare and wonderful thing.
Bill Gates, Tiger Woods, John Carmack, Michael Jordan, Eminem, Metallica, Warren Buffet, Mark Zuckerburg, Steve Wozniak, all seem to have this kind of thing in common.