The most obvious advantage to working on an open source project is that you can share your code with a potential employer. There are no nondisclosure agreements or proprietary restrictions that keep you from sending out a pointer to your corner of the project and saying, "I wrote that." Anyone can look at it. If you've achieved committer status, it shows you work well enough with others and know how to contribute to an ongoing project. Those are valuable skills that many programmers never develop.
Some of the most popular open source projects are now part of enterprise stacks, so companies are increasingly looking for developers who are part of the community built around the open source projects on which their stack depends. One manager at a major server company told me he couldn't afford to hire Linus Torvalds, but he needed Linux expertise. He watched the Linux project and hired people who knew Linus Torvalds. If the email lists showed an interaction between Torvalds and the developer, the manager picked up the phone.
Many open source projects require support, and providing this can be a side job that leads to a full-time career. Companies often find it much cheaper to adopt an open source technology and hire a few support consultants to make it all work, rather than go proprietary.
Savvy programmers are also investing early in open source projects by contributing code. They can work on cutting-edge open source projects on the side just because they're cool. If the project turns into the next Hadoop, Lucene, or Linux, they'll be able to turn that experimentation into a job and, quite possibly, a long-lasting career.
How do you work around ageism?
What does every tech recruiter want? An unmarried 21-year-old new graduate of a top computer science institution ready to work long hours and create great things. What about a 22-year-old with a year of experience? Uh. Maybe. Perhaps. Are there any 21-year-olds available?
One of the great, often unspoken, rules of the programming world is that managers have very narrow ideas of the right age for a job. It's not that managers want to discriminate, and it's not that humans want to change as they get older -- but they do. So everyone clings to stereotypes even if they're against the law.
This is often most obvious in the hypercompetitive world of tech startups, where the attitude is like the NBA. If you got stuck finishing your degree, you're obviously not special enough. This world prizes people who spend long hours doing obsessive things. They like youth, and it's not uncommon to hear venture capitalists toss aside anyone who's not a younger 20-something.