Software engineer, data infrastructure at LinkedIn
My doctorate is in astrophysics, so this won't fully answer your question, but I do have a BS in mathematics and a good grad-school friend who's now a mathematics professor in southern California, so hopefully it won't be far off.
The main criterion is the obvious one: take as many mathematics courses and work on as many math problems as possible, from grade school on up. You'll typically start with a year-long course in calculus your freshman year in college, but it's a good idea to have taken calc in high school as well--along with trig, analytic geometry, etc. Differential equations are another core requirement in most departments, I think, but you'll also want a good sampling of "peripheral" topics like probability/statistics, number theory, set theory, complex analysis, etc. In my school there were three hard-core, year-long courses--classical analysis, abstract algebra (group/ring/field theory), topology--and my advisor strongly suggested that I take at least two of them. (I was also majoring in physics, so taking all three wasn't an option.)
If you're up for it, I also recommend participating in regional and/or national mathematics competitions, both in high school and in college. I believe the MAA sponsors one of the former, and some states (e.g., Tennessee) have their own, too. The premier college competition is the Putnam Exam; it's pretty tough, but I think the older tests are available online, so if nothing else, you can practice working those. (Don't get too discouraged; I think the average score for the six-hour test is equivalent to getting just one of the 12 problems correct--or such was the case when I took it, anyway.)
The first couple of years of grad school is similar to college in that you'll take more (and more advanced) courses prior to taking the Ph.D. candidacy exam. (One typically doesn't bother with a Masters degree when going for a Ph.D. in math or the physical sciences--though there may be an option to request one at some stage, which may boost your internship salary at some companies.) Thereafter you may take a few more classes (and you'll certainly attend weekly seminars covering the latest research from around the world), but more typically you'll hook up with a professor whose interests align with yours and start doing research. Initially it will be strongly directed by him or her, but before long you'll start setting the direction yourself, presenting at conferences (usually "poster papers," which are amusingly similar to grade-school science fairs in some ways), and--with a little luck--you'll spot an interesting, new problem of sufficient depth that solving it will earn you your degree.