The lemon juice lowers the pH of the jam, which neutralizes negative charges on the strands of pectin and helps your jam set and thicken after it cools down for a few hours.