The High Court rejected laws that impose up to seven years in prison for same-sex relationships, stating they were unconstitutional.
The move contrasts with Kenya’s recent ruling against campaigners seeking to overturn laws on gay sex.
Angola, Mozambique and the Seychelles have all scrapped anti-homosexuality laws in recent years.
The Botswana law has been in place since 1965 when it was brought in by the colonial British government.
The case was brought to court by a student who argued society had changed and homosexuality was more widely accepted.