The COVID-19 pandemic affected daily life routines and lifestyles of pregnant and postpartum women and increased their stress and risk of suffering from mental health problems. The aim of this study was to analyse which sociodemographic variables, COVID-19 exposure variables and lifestyles to cope with stress variables predicted anxiety, depression, and PTSD symptoms in pregnant and postpartum women during the COVID-19 pandemic. A cross-sectional design was performed with a sample of 3356 Spanish women participating in the Riseup-PPD-COVID-19 study. These participants completed an online survey composed of measures of anxiety (GAD-7), depression (EPDS), and PTSD related to COVID-19 (Checklist DSM-5), as well as demographics, exposure to COVID-19, and lifestyles to cope with stress. Regarding results, 47.2% showed depression and a third reported anxiety, whereas moderate scores were observed in PTSD symptoms. The most commonly used strategies to cope with stress in the COVID-19 pandemic were talking with friends and family and increasing time with social networks. Better results in mental health were associated with coping strategies such as talking with family and friends or participating in family activities, physical activity, sleeping well at night, eating healthier, and increasing personal care. Furthermore, poor results in mental health were observed in those participants who increased time with screens, ate fast food, reported substance use, and talked more frequently with health professionals. More symptoms were also observed in younger women, primiparous women, and those who reported more exposure to COVID-19. The results underline the need to strengthen the mental health of pregnant and postpartum women. Trial registration: ClinicalTrials.gov Identifier: NCT04595123.