Rapid HIV tests are used in maternity hospitals to prevent mother-to-child transmission. This study aimed to analyze factors associated with submission to the rapid HIV test (outcome). This is a cross-sectional study conducted in 2009 in 15 hospitals from the Rio de Janeiro's Unified Health System (SUS) by interviewing a representative sample of 835 pregnant women hospitalized for birth and by verifying medical records. Adjusted prevalence ratios were obtained by Poisson regression according to a hierarchical model, and variables associated with the outcome (p ≤ 0.05) remained in the final model. According to medical records (MR), 79.6% of mothers were submitted to rapid HIV test and, according to interviews (INT), 55.7%. At the distal level, the lack of a partner (MR), having ≥ 6 residents at home (MR) and non-white skin color (INT) were associated with a higher prevalence of the outcome. At the intermediate level, not having a negative HIV serology from prenatal care (MR and INT) was associated with a higher prevalence of the outcome, as well as PHC prenatal care (MR) and lack of prenatal care (INT). At the proximal level, delivery in a hospital not certified as Baby-Friendly was associated with a higher prevalence of outcome (MR and INT).