Mahjoubi, at 34 one of the youngest members of President Emmanuel Macron's centrist government, tweeted late Thursday that homophobia "sometimes forces us to adapt ourselves and lie just to avoid hate and to survive".
"Homophobia is an ill that eats away at society, invades high schools, and poisons families and lost friends," the former tech entrepreneur posted.
L’homophobie est un mal qui ronge la Société, envahit les collèges et les lycées, contamine les familles et les amis perdus. Pire, elle hante les esprits des homosexuels, et nous oblige parfois, souvent, à nous adapter et mentir pour éviter la haine, pour vivre. #IDAHOBIT2018Mounir Mahjoubi (@mounir) May 17, 2018
Thursday marked the International Day Against Homophobia, Transphobia and Biphobia, and Mahjoubi said on Friday that while he did not want to "make a big deal" of coming out publicly, "if that might help to fight homophobia, I'll do it".
"I think it's important to offer visibility to gay people, but I think everyone should take this step only when they're ready for it," he told the Franceinfo news website.
French gay rights group SOS Homophobie hailed his "strong and courageous decision".
"He is contributing to the visibility of LGBT (lesbian, gay, bisexual and transgender) people in society and is a positive example for all young gay, bi and trans people in his country," the group tweeted. "Congratulations."
Mahjoubi has been in a civil partnership with his partner since 2015 and had posted on Instagram a photo of the couple on the day of the ceremony, before he became a public figure.
"It's 2018, I live my life -- even in public -- in peace," the minister said.
But he indicated that he had suffered from homophobic attitudes in the past, without giving details.
"We have to remember the consequences of homophobia in daily life, notably for the young. It has also had consequences for me," he said.
France legalised civil partnerships for gay couples in 1999, followed by same-sex marriage in 2013.
Macron's government includes a few junior ministers who opposed gay marriage ahead of the law change.
Asked if Mahjoubi had raised the issue with them, he told Franceinfo: "I spoke to them about my husband, who is a wonderful man, as soon as I met each of them.
"It was important because we were part of a new movement and we had to set out how we were going to do this together," he said.
"But I can assure you that for each of them, including comments that might have been awkward at the time, there's no issue. They are totally committed to fighting homophobia and today they totally support equality."
A handful of ministers in previous French governments have come out as gay or bisexual, including Frédéric Mitterand, nephew of former president François Mitterand.
Mahjoubi, born in Paris to Moroccan parents, worked in start-ups as well as online political campaigning before running the digital campaign to elect Macron and then joining his cabinet.