"Many professional athletes, gay and straight, are speaking out against prejudice," Ban told the session of the International Olympic Committee in Sochi in a keynote address.
"We must all raise our voices against attacks on lesbians, gays, bisexual, transgender or intersex people. We must oppose the arrest, imprisonment and discriminatory restrictions they face," he added.
Ban did not specifically address the situation in Russia, where last year parliament passed a hugely controversial law banning the dissemination of "gay propaganda" to minors.
However the fact that Ban chose to make such a strong statement in Russia just one day before the start of the Olympics means that it carries strong symbolic force.
"I know principle six of the Olympic Charter enshrines the IOC's opposition to any form of discrimination," said Ban.
"Hatred of any kind must have no place in the 21st century," Ban added.