It was intolerable that people were “persecuted for their origins, their sexual orientation, their religion and their convictions”, he said.
Mr Di Rupo was addressing African and European leaders attending the EU-Africa summit in Brussels.
Nigeria and Uganda have toughened anti-gay laws this year.
Their presidents – Goodluck Jonathan and Yoweri Museveni – are at the summit, which is discussing ways to strengthen relations between the EU and Africa.
Homosexual acts are illegal in most African countries, where homosexuality is often seen as “evil” and “abnormal”.
Mr Di Rupo is Europe’s second openly gay government leader, after Iceland’s Prime Minister Johanna Sigurdardottir.
“We cannot tolerate that some are denied their rights and persecuted for their origins, their sexual orientation, their religion and their convictions,” he said on Wednesday, at a welcome dinner for some 80 leaders.
Mr Museveni and Mr Jonathan have not responded to his comments.
Uganda’s authorities have previously defended the tougher anti-gay law, saying Mr Museveni wanted “to demonstrate Uganda’s independence in the face of Western pressure and provocation”.
The law allows life imprisonment as the penalty for acts of “aggravated homosexuality” and also criminalises the “promotion of homosexuality”.
Homosexual acts were already illegal in Uganda when Mr Museveni approved the law in February.
Some people known or suspected to be gay have faced “violence and retaliation” since then, rights activists say.
Late last year, Nigeria’s parliament passed a bill which bans same-sex marriages, gay groups and shows of same-sex public affection.
Mr Jonathan signed it into law, with backing from influential Muslim and Christian clerics.
Homosexual acts were already illegal in Nigeria under both secular and Islamic law when the law was approved.
Five people have been convicted of homosexual offences by Islamic courts in Nigeria’s mainly Muslim north since January.
Several European nations – including Denmark, Norway, the Netherlands and Sweden – have cut aid to Uganda to show their opposition to the law.
The World Bank has postponed a $90m (£54m) loan to Uganda to improve its health services after the law was approved.