I kind of felt the numbers in 1800Info's were out, so here's my napkin calculation, I apologise that a lot of this isn't very PC, it's not meant to offend it's just a crude, pragmatic estimate.
Most official estimates indicate the global population (P) is approx 6700M (it's been >4000M since the early 70's). The amount of programmers in what is rather disparagingly referred to as the third world, but basically meaning sub-saharan africa (P*0.14) and agricultural asia can be assumed to be negligible. Generously assuming the entirety of asia (P*0.6) has the same rural/urban distribution as china (58/42), that leaves:
P -= (P*0.14) + (P*0.6*0.42) = 3430M
(the first term is the non-asia, non-africa population)
Of that roughly speaking developed population, 25% are aged under 20 and 10% are retired. Of that adult working age population, a rough estimate of 10% are unemployed or otherwise unable to work.
P *= .65 * .9 = 2006M
Now the estimates get really rough. How many of those adults are non-working and not register unemployed? How many have access to a computer? What qualifies someone as a programmer anyway? Using 1800info's questionable numbrs (30%, 1%) this still leaves no more than 6M.
OTOH, the US government says that 3.1M of a working population of 134M americans describe themselves as programmers (or related). Perhaps you culd just use that as your estimate. :P
All stats just pulled from wikipedia.