|Archbishop Desmond Tutu [photo:BBC]|
His comments come in an analysis in The Lancet journal of why incidence of the virus continues to grow among men who have sex with men.
Dr Tutu said anti-homosexuality laws would in the future be seen as "wrong" as apartheid laws are now.
Campaigners said it was important for community leaders to speak out.
Writing in The Lancet, he said: "In the future, the laws that criminalise so many forms of human love and commitment will look the way apartheid laws do to us now - so obviously wrong.
"Never let anyone make you feel inferior for being who you are. When you live the life you were meant to live, in freedom and dignity".
Also writing in The Lancet, an international team of researchers, led by Prof Chris Beyrer of the Johns Hopkins Bloomberg School of Public Health in the US, said men who have sex with men (MSM) bore a "disproportionate burden" of HIV.
Earlier this week, the US Food and Drug Administration approved Truvada for preventative use in those at high risk of infection and who may engage in sexual activity with HIV-infected partners, the first time it has approved a drug to prevent HIV infection.
'Struggle for equity'