How are the banded-iron-formation iron-ores formed?
A few elements to complement @Siv answer, and some alternatives hypotheses:

Originally the idea was that the Fe2+ oxidation into Fe3+ that lead to the formation of the BIF ("banded iron formations") was an indirect consequence of the increased atmospheric pO2 caused by the photosynthetic activity of, then freshly appeared, cyanobacteria (see e. g. Cloud 1973  which, along with Cloud 1968, are i think the first occurrence in the literature of such an idea). 

Later, the idea that the cause of the iron oxidation was linked to a specific metabolic reaction involved in anoxygenic photosynthesis (i. e. a different way of fixing CO2 that does not create O2) in bacteria was also introduced (Hartman 1984; Konhauser et al. 2005).  

Another possibility invoked by Holm 1989 is the active oxidation of Fe2+ by "chemolithoautotrophic" bacteria (using it directly as energy source).

Finally, the only (as far as I can see) non-bacterial hypothesis on the BIF formation is that of photo-oxidation (Braterman et al. 1983): the oxidation and precipitation of Fe2+ in Fe3+ being indeed possible without oxygen, in strongly acid conditions with a little help from UV photons.

References:
Braterman P. S., Cairns-Smith A. G., Sloper R. W., 1983. Photo-oxidation of hydrated Fe2+ – significance for banded iron formations. Nature, 303: 163-164.
Cloud P., 1968. Atmospheric and hydrospheric evolution on the primitive earth. Science, 160, 729–736.
Cloud P., 1973. Paleoecological Significance of the Banded Iron-Formation. Economic Geology and the Bulletin of the Society of Economic Geologists, 68: 1135-1143.
Hartman H., 1984. The evolution of photosynthesis and microbial mats: A speculation on the banded iron formations. In Y. Cohen et al. (Eds), Microbial  Mats: Stromatolites, Alan Liss Inc. (New York): 449–453.
Holm N. G., 1989. The 13C/12C ratios of siderite and organic matter of a modern metalliferous hydrothermal sediment and their implications for banded iron formations. Chemical Geology, 77: 41-45.
Konhauser K. O., Newman D. K., Kappler A., 2005. The potential signiﬁcance of microbial Fe(III) reduction during deposition of Precambrian banded iron formations. Geobiology, 3, 167–177.