Background This paper was the first study comparing levels of anxiety and depression and assessing the affecting factors among the general population, frontline healthcare workers, and COVID-19 inpatients in Turkey during the first wave of the COVID-19 pandemic. We collected data from the general population (n = 162), frontline healthcare workers (n = 131), and COVID-19 inpatients (n = 86) using Individual Characteristics Form, Generalised Anxiety Disorder Scale, and Beck Depression Inventory in this cross-sectional study. Results An increased prevalence of depression and anxiety were found predominantly in frontline healthcare workers (p < 0.001). COVID-19 inpatients and frontline healthcare workers were more likely to demonstrate anxiety (p < 0.001) than the general population. In the regression analysis, while fear of infecting relatives was a significant predictor of anxiety and depression in the general population, gender and experiencing important life events were associated with anxiety. Fear of infecting relatives and lack of personal protective equipment while providing care were predictors of anxiety and depression in healthcare workers (p < 0.001). Furthermore, the fear of being re-hospitalised due to re-infection was a predictor of depression and anxiety levels of the COVID-19 inpatients. Conclusion Policymakers and mental health providers are advised to continuously monitor psychological outcomes and provide necessary health support during this pandemic.