Despite the global scale-up of antiretroviral therapy (ART), incarcerated people have not benefited equally from test-and-treat recommendations for HIV. To improve access to ART for incarcerated people with HIV, we introduced a universal test-and-treat (UTT) intervention in correctional facilities in South Africa and Zambia, and aimed to assess UTT feasibility and clinical outcomes. Treatment as Prevention (TasP) was a multisite, mixed methods, implementation research study done at three correctional complexes in South Africa (Johnannesburg and Breede River) and Zambia (Lusaka). Here, we report the clinical outcomes for a prospective cohort of incarcerated individuals who were offered the TasP UTT intervention. Incarcerated individuals were eligible for inclusion if they were aged 18 years or older, with new or previously diagnosed HIV, not yet on ART, and were expected to remain incarcerated for 30 days or longer. To enable the implementation of UTT at the included correctional facilities, we first strengthened on-site HIV service delivery. All participants were offered same-day ART initiation, and had two study-specific follow-up visits scheduled to coincide with routine clinic visits at 6 and 12 months. The main outcomes were ART uptake, time from cohort enrolment to ART initiation, and retention in care and viral suppression at 6 and 12 months. We estimated the association between baseline demographic characteristics and time to ART initiation using Cox proportional hazard models, and, in a post-hoc analysis, we used logistic regression models to assess the association between demographic and clinical variables, including time to ART initiation, and the proportion of participants with a composite poor outcome (defined as viral load >50 copies per mL, or for participants with a missing viral load, lack of retention in care in the on-site ART programme) at 6 months. This study is registered at ClinicalTrials.gov, NCT02946762. Between June 23, 2016, and Dec 31, 2017, we identified 1562 incarcerated people with HIV, of whom 1389 (89%) were screened, 1021 (74%) met eligibility criteria, and 975 (95%) were enrolled and followed up to March 31, 2018. At the end of follow-up, 835 (86%) of 975 participants had started ART. Median time from enrolment to ART initiation was 0 days (IQR 0-8). Of 346 participants who remained incarcerated at 6 months, 327 (95%) were retained in care and 269 (78%) had a documented viral load, of whom 262 (97%) achieved viral suppression (<1000 copies per mL). The mortality rate among the 835 participants who had initiated ART was 1·9 per 100 person-years (95% CI 0·9-3·9). No statistically significant associations were identified between any baseline characteristics and time to ART initiation or composite poor outcome. UTT implementation is feasible in correctional settings, and can achieve levels of same-day ART uptake, retention in care, and viral suppression among incarcerated people with HIV that are comparable to those observed in community settings. UK Department for International Development, Swedish International Development Cooperation Agency, Norwegian Agency for Development Cooperation.