This study aimed to determine the longitudinal effects of pre-pregnancy and pregnancy sleep on maternal depression at one month postpartum, stratified by parity. We used data from the Japan Environment and Children’s Study, a cohort study that registered 103,060 pregnancies between 2011 and 2014. A total of 76,977 women were included in this study and were asked about their sleep pre-pregnancy and during pregnancy, and whether they had postpartum depression. We found that those who slept 8–9 hours in pre-pregnancy had slightly lower odds of postpartum depression compared with those who slept 7–8 hours (odds ratio OR = 0.92, 95% confidence interval CI:0.87–0.99), and those who had bedtimes other than 9 p.m. to 3 a.m. had increased OR compared with those who had bedtimes between 9 p.m. and midnight (OR = 1.14, 95% CI:1.00–1.31). During pregnancy, those who slept less than 6 hours and whose bedtime was other than 9 p.m. to 3 a.m. had increased ORs of postpartum depression (OR = 1.21, 95% CI:1.09–1.31; OR = 1.25, 95% CI:1.08–1.45, respectively). Poor sleep quality during pre-pregnancy and pregnancy increased the odds of postpartum depression. To prevent postpartum depression, it is important for women to have good sleep from pre-pregnancy.