Basically it boils down to whether you think whatever you personally gain from contributing outweighs the likelihood (or certainty) of not making money from it.
It's also worth noting that there's nothing inherently evil or distasteful about proprietary software. It's proprietary exactly because it's meant to produce a monetary return on the time and effort invested in it.
Whether you aim for monetary gain, and with what degree of certainty, is just a personal choice you make.