Objective This study aimed to investigate the relationship between autism spectrum disorder (ASD) and vitamin D levels in children and adolescents. Methods We measured serum 25-hydroxyvitamin D (25-OHD) levels in 1529 patients with ASD aged 3 to 18 years, without any additional chronic diseases. Levels of 25-OHD were compared according to sex, age (<11 or >= 11 years), and birth season. Additionally, laboratory parameters (calcium, phosphorus, alkaline phosphatase, and 25-OHD) of 100 selected patients with ASD were compared with those of the healthy control group. Results Vitamin D deficiency or insufficiency was found in approximately 95% of all patients. Levels of 25-OHD in adolescent patients with ASD aged 11 to 18 years were significantly lower than those in patients aged younger than 11 years. In the 100 selected patients with ASD, mean serum 25-OHD levels were significantly lower and alkaline phosphatase levels were higher compared with those in healthy children. Conclusion Our study suggests a relationship between vitamin D and ASD in children. Monitoring vitamin D levels is crucial in autistic children, especially adolescents, to take protective measures and treat this condition early.