Background: The prevalence of chronic constipation is increased in females and with age or environmental (low temperature), racial, socioeconomic, and habitual risk factors. The impact of low outside temperature on constipation drug use remains unclear. Here, we investigated risk factors for constipation drug use by evaluating data from the Japanese National Database. Methods: This ecological study used the 2016 open Japanese National Database of health insurance claims (prescriptions) to acquire the number of health insurance prescription claims in all 47 prefectures for drugs to relieve constipation, antihypertensives, vasodilators, as well as medical checkups and questionnaire responses. Internet survey on room temperatures in 2010 were also used. Pearson correlation coefficients (r) between the number of population-based prescriptions for each item were calculated and multiple linear regression analysis (MLR) was performed. Results: Prescriptions for magnesium laxatives significantly correlated with aging (r = 0.58), vasodilators (r = 0.53), being female (r = 0.43), antihypertensives (r = 0.39), and inversely with eating ≤2 h before bedtime (r = − 0.37), total crime rate (r = − 0.33), insomnia (r = − 0.33), and population density (r = − 0.31). Stimulant laxatives (sennoside and picosulfate) were significantly correlated with antihypertensives (r = 0.79), aging (r = 0.69), vasodilators (r = 0.67), and being female (r = 0.56), and were inversely associated with average outside temperature (r = − 0.62), total crime rate (r = − 0.52), average income (r = − 0.51), and 30-min of vigorous exercise (r = − 0.44). Fecal interventions were significantly correlated with aging (r = 0.55) and female (r = 0.59), and inversely correlated with population density (r = − 0.41) and total crime rate (r = − 0.38). MLR analysis identified aging as the only significant risk factor for magnesium laxative use (partial slope [β] = 1241.0). Female sex and antihypertensives were independent risk factors for stimulant laxative prescriptions (β = 44,547.0 and 0.2) and average outside temperature and 30-min of vigorous exercise were independent preventive factors (β = − 616.8 and − 219.1). Conclusion: We identified associations of magnesium laxatives with aging, stimulant laxatives with female sex, antihypertensives, low outside temperature and less 30 min of vigorous exercise.