Frequent, extended periods of unpaid leave are easily compatible with certain types of academic careers, such as teaching as an adjunct on a course-by-course basis. However, this involves low pay and no prestige or job security, so it's far from an ideal solution.
There will be a lot of obstacles to doing this with a tenure-track job. Your collaborators will be unhappy when you put the collaboration on hold to go do something else. You colleagues will be unhappy when you aren't available to teach courses or supervise students (thereby making the department work around what they consider to be your eccentricities). Wanting to take substantial amounts of time off will be considered a bad sign, and everyone will worry about what you might do once you have tenure. Your chances of getting tenure will go down.
Taking time off can also make you a less productive researcher, even normalized by the amount of time you spend on research. The problem is that keeping up with the field takes a certain amount of time and effort. If you work on research for only six months per year, you still need to keep up with twelve months of progress by others, so it's as if the rest of the world were moving twice as fast.
It's not impossible that you could find a flexible academic job. You might end up with a specially negotiated soft-money position (funded by grants under whatever terms the funding agency will agree to), you might take a job at a less prestigious university than you could have (who are so eager to hire you that they are willing to make a deal), or you might happen to find an unusually accommodating department. Unfortunately, this isn't something most people can reasonably expect to work out. I don't know what the chances are, but I expect they are pretty low on average. The academic job market is tough, and adding non-standard constraints makes it even tougher. If you can't be happy without frequent, extended leaves, and you have good non-academic employment options that fit your needs, then that might be the way to go.
Another theoretical option is to take advantage of tenure: work hard, don't tell anyone your plans, and then quit doing any academic work over the summer once you get tenure. You shouldn't do this. Your colleagues will feel resentful, the administration will be upset, and you'll be manipulating the system in a way tenure is not intended to support (and thus weakening the case for having tenure at all). If you're too extreme, you could run into trouble with a post-tenure review, depending on your university's policies.
[I'm assuming you intend to use the leaves for something entirely unrelated to your academic career. If it's more closely related, such as applying your scholarly expertise to government service, then you may have better luck. However, it doesn't sound like that's what you're talking about.]