Before contributing, decide if you would like your contributions to remain anonymous or not.
If you don't want to be anonymous: Join us on the IRC channel, you can usually get instant answers in certain times of the day.
If you want to be anonymous: Contact us by FMS on the board "freenet".
Notice: Most developer communication happens on the IRC channel, so that should be preferred if possible.
Obtaining the source code
See: Building from source
What should I program?
First of all, chose a sub-project which you like from the Projects page.
If it is an official one, the bugtracker is full of thousands of ideas for features which Freenet needs. The roadmap page will give you an overview of what the issues for the next few versions are. Make sure to chose the right project at the top right.
If it is not official, contact the author and ask for ideas what to implement.
In any case, it is probably a good idea to join us on IRC channel and ask us for help in contributing to the sub-project of your choice.
Layering in Freenet
Diagram of most of the layers in Freenet: