The present study examined whether exposure to vitamin D from fortified margarine and milk during prenatal life influenced mean birth weight and the risk of high or low birth weight. The study was based on the Danish vitamin D fortification programme, which was a societal intervention with mandatory fortification of margarine during 1961–1985 and voluntary fortification of low-fat milk between 1972 and 1976. The influence of prenatal vitamin D exposure on birth weight was investigated among 51 883 Danish children, by comparing birth weight among individuals born during 2 years before or after the initiation and termination of vitamin D fortification programmes. In total, four sets of analyses were performed. Information on birth weight was available in the Copenhagen School Health Record Register for all school children in Copenhagen. The mean birth weight was lower among the exposed than non-exposed children during all study periods (milk initiation − 20·3 (95 % CI − 39·2, − 1·4) g; milk termination − 25·9 (95 % CI − 46·0, − 5·7) g; margarine termination − 45·7 (95 % CI − 66·6, − 24·8) g), except during the period around the initiation of margarine fortification, where exposed children were heavier than non-exposed children (margarine initiation 27·4 (95 % CI 10·8, 44·0) g). No differences in the odds of high (>4000 g) or low ( < 2500 g) birth weight were observed between the children exposed and non-exposed to vitamin D fortification prenatally. Prenatal exposure to vitamin D from fortified margarine and milk altered birth weight, but the effect was small and inconsistent, reaching the conclusion that vitamin D fortification seems to be clinically irrelevant in relation to fetal growth.