the lemon juice lowers the ph of the jam mixture, which also neutralizes those negative charges on the strands of pectin, so they can now assemble into a network that will "set" your jam.