Not that I speak from business know-how, but I have a hunch that a programmer who demonstrates excellence (without pay) in view of the community, receives an invitation of some kind to make money before long. Luck no doubt plays a part, as well as a talent for recognizing which field has potential for growth. Also the ability to market oneself. Also the ability to negotiate a beneficial business deal. Gee, that sounds like one needs a large variety of skills, doesn't it?
In that sense the open source communities (GitHub, GNU, etc.) become an avenue for you to advertise what you have to offer. On one hand you work for free, but on the other hand it's free advertising.
Example, early home computer users had access to a wide range of shareware programs, written by various people who didn't charge money outright, but requested a fee 'after you decide their program is useful.' The fee was less than commercial businesses charged. Some shareware was good enough that programmers gained entrance to a contract with Apple, or a programming house, or enterprising business partners.