Background Female sex workers (FSWs) face a significant and persistent risk of contracting HIV. While evidence indicates high rates of pregnancy among FSWs in sub-Saharan Africa, studies on the coverage of HIV testing during pregnancy among them are sparse. The objective of this study was to estimate the prevalence of prenatal HIV testing and determine the associated factors among FSWs in Nigeria. Methods This study was a secondary data analysis of the 2020 Integrated Biological & Behavioural Surveillance Survey (IBBSS) among key populations in Nigeria. We performed weighted descriptive statistics and multivariable binary logistic regression to assess the associations between prenatal HIV testing and sociodemographic characteristics, risk behaviours, HIV knowledge and risk awareness, stigma, and access to healthcare. Results Of the 1598 FSWs included in the study, 71.0% (95%CI = 68.7%–73.1%) had HIV testing during their last pregnancy. In the regression model, tertiary education (aOR = 2.98, 95%CI = 1.48–6.01), consistent condom use (aOR = 1.95, 95%CI = 1.39–2.75), and receipt of antenatal care (aOR = 35.52, 95%CI = 23.40–53.92) were associated with higher odds of prenatal HIV testing. Compared with the South South geopolitical zone, FSW residing in South East (aOR = 3.38, 95%CI = 1.80–6.35), South West (aOR = 2.97, 95%CI = 1.88–4.68), North Central (aOR = 4.43, 95%CI = 2.80–7.01), North East (aOR = 4.22, 95%CI = 1.64–10.34), North West (aOR = 4.40, 95%CI = 2.59–7.48) had higher odds of reporting prenatal HIV testing. However, being a non-brothel-based FSW (aOR = 0.66, 95%CI = 0.47–0.92), and engaging in sex work during pregnancy (aOR = 0.45, 95%CI = 0.31–0.66) were significantly associated with lower odds of prenatal HIV testing. Conclusions The prenatal HIV testing among FSWs in this study was suboptimal. The results highlight the need to improve access to antenatal care and implement regional and typology-specific interventions to bridge the gap in prenatal HIV testing among FSWs.