Both hepatitis B virus (HBV) and hepatitis C virus (HCV) are major sources of morbidity and mortality worldwide; however, their prevalence in key groups in Colombia is not yet known. We aimed to analyse the prevalence of HBV and HCV and its associated factors in key groups who were treated at an institution providing health services in Colombia during 2019. This was a multiple-group ecological study that included 2,624 subjects from the general population, 1,100 men who have had sex with men (MSM), 1,061 homeless individuals, 380 sex workers, 260 vulnerable young people, 202 drug users, 41 inmates and 103 people from the lesbian, gay, bisexual and transgender community. Prevalence of infection with a 95% confidence interval and its associated factors was calculated for each group. Confounding variables were assessed using logistical regression and SPSS 25.0 software. Prevalence of HBV and HCV in the general population was 0.15% and 0.27%, respectively; 0.27% and 2.09% in MSM; 0.37% and 2.17% amongst homeless individuals; 0.26% and 0.0% amongst sex workers; 0.39% and 0.0% amongst vulnerable youth; and 5.94% and 45.54 amongst injecting drug users. In the multivariate HBV model, the explanatory variables included the study group, city of origin and the type of health affiliation; for HCV they were group, origin, sex, age group, health affiliation, use of drugs and hallucinogen use during sexual intercourse. A high prevalence of HBV and HCV were evidenced for both viral infections, which was, consequently, much higher within the key groups. The main associated factors that were identified related to origin and type of health affiliation and demonstrated a double vulnerability, that is, belonging to groups that are discriminated and excluded from many health policies and living under unfavourable socioeconomic conditions that prevent proper affiliation and health care.