The same goes for programmers as it goes for pretty much everyone else ... watch your intake (most people today - even the skinny ones - take lots more in then they need) and do some kind of physical activity (swimming, running and cycling for example).
Now, most would say ... I haven't got the time for that. - but it is all questionable. For, programming is first thinking, typing second (or third) - you haven't actually got to be at your computer all of the time to do your work, as long as you can think of it (this has some issues with certain people, but if you show you're good at what you do they usually agree that they don't have to make you sit on your chair all the time, for you to do your job) and have the mental capabilities to visualize it in your head (most do).
... all there is to it, really. People are ment to move and have been moving for several millenia now ... no magic in that area (in regards to food, diets, whatever) will let them stay healthy if they sit on their respected ones all they long.
p.s. Laptops help ... you can work in several places (e.g. from the garden at home, ... can easily rearrange your office at work ... Hell, you can go to the mountains in your car, just find a nice place, lay somewhere and enjoy the scenery and work ...)