Background Human immunodeficiency virus (HIV) testing during pregnancy is crucial for the prevention of mother-to-child transmission of HIV, thus aiding in prompt treatment, care, and support. However, HIV testing among pregnant women in Rwanda has been barely explored. This study, therefore, aimed to determine the prevalence and associated factors of HIV testing among pregnant women in Rwanda.Methods Secondary data from the 2020 Rwanda Demographic and Health Survey comprising 870 pregnant women were used. Multistage stratified sampling was used to select participants. Multivariable logistic regression was conducted to determine the factors associated with HIV testing, using SPSS (version 25).Results Of the 870 pregnant women, 94.0% (95% CI: 92.3–95.4) had tested for HIV during their current pregnancy. Younger age (AOR = 1.54, 95%CI: 1.54–4.42), not working (AOR = 4.29, 95%CI: 1.52–12.08), large household size (AOR = 2.96, 95%CI: 1.01–8.61), multiple sex partners (AOR = 4.16, 95%CI: 3.01–5.74), as well as secondary (AOR = 8.07, 95%CI: 2.15–11.43), primary (AOR = 5.53, 95%CI: 1.28–9.74) and no (AOR = 6.07, 95%CI: 1.21–10.44) education were positively associated with HIV testing. However, being unmarried (AOR = 0.28, 95% CI: 0.19–0.86), belonging to the western region (AOR = 0.20, 95% CI: 0.63–0.66), having not visited a health facility (AOR = 0.22, 95%CI: 0.10–0.48), and not having comprehensive HIV knowledge (AOR = 0.68, 95%CI: 0.30–0.55) were negatively associated with HIV testing.Conclusions A high proportion of pregnant women had tested for HIV. However, there is a need for improved access to HIV education and testing facilities to address regional imbalances. The need for consideration of occupation, family and household dynamics in HIV testing promotion strategies is also highlighted.