The primary causes of freckles are sun exposure and genes. The MC1R gene, responsible for stimulating melanin production, also causes freckles. Coincidentally, red hair is also caused by the same gene.
The normal-functioning MC1R gene converts any pigment that the body produces to eumelanin, which is responsible for black and brown hair and skin colors. Some changes in the MC1R gene results in the production of pheomelanin from the pigments. Pheomelanin causes reddish hair as well as freckles.
So, if a person carries the pheomelanin version of the MC1R gene, it's likely that she or he will have red hair and develop freckles.
You can learn more about the MC1R gene here.