As a programmer, how do I keep myself fit?I think it may first + foremost depend upon the schedule you keep + who's in charge of your time. If you are a freelancer who works remotely, then time management + discipline are primarily (if not exclusively) up to you. I will answer with this being the case (as it has been sometime - if I can recall perhaps ever - the case of otherwise).
Being that you are on your time with everyone (aside from the deadlines you hopefully manage amiably with your contractor(s)), what I tend to do is make time in the day to hit the gym. This is anywhere from 30 minutes to a couple of hours depending upon the circumstances. If I am feeling stressed or trying to solve a problem (e.g. debug, troubleshoot, architect a solution), it really helps to step away from the desk/office/computer for a while to work out one's thoughts or aggression (in the case of conflict with clients or code). I strongly recommend this as a strategy for anyone despite their time arrangement.
I also take the gym time (especially if doing cardio) to catch up on other things such as articles, reads or correspondence via my ereader, tablet or smartphone. One can also listen to podcasts or watch videos if so desired. I have surprisingly actually read several books over the course of a week's workout - something that may not have happened otherwise!
If that doesn't work out, you can always invest in the following: