BackgroundGlobally, major emphasis has been placed on understanding the physiological consequences of losing a pregnancy. However, its mental health impact on socially disadvantaged women remains unexplored. To further inform the field the present study investigated the prevalence and factors associated with the development of depressive symptoms and anxiety among women with a history of spontaneous abortion living in the urban slums of Dhaka, Bangladesh.MethodsInformation was obtained from 240 women who experienced a spontaneous abortion from July 2020 to December 2021. It was obtained through the urban health and demographic surveillance system (UHDSS) survey. Generalized Anxiety Disorder (GAD-7) and Patient Health Questionnaire (PHQ-9) were used to measure mental health symptoms. Bivariate and multivariate linear regression analyses were performed to assess the associated factors with the mental health outcomes.ResultsOf the 240 women, majority (77.50%) of the women experienced mild to severe depressive symptoms and more than half (58.75%) of the respondants experienced mild to severe anxiety, within one and half years of experiencing spontaneous abortion. A higher level of education and being employed were protective factors for anxiety and depressive symptoms, respectively. However, women with higher sexual and reproductive health rights (SRHR) knowledge had significantly increased anxiety and depressive symptoms. In contrast, receiving post-abortion care (PAC) was associated with decreased anxiety and depressive symptoms.ConclusionThe findings indicate that ensuring access to affordable PAC services and integrating mental health services into the standard PAC service package is crucial. This study also emphasizes the importance of providing education for women living in urban slums and encouraging them to participate in economic activities.Supplementary InformationThe online version contains supplementary material available at 10.1186/s40359-023-01224-0.