The group pleaded not guilty to charges relating to conspiracy, unlawfully assembly and membership in an unlawful society, the BBC reports.
Homosexuality has been illegal in Nigeria since 2014, and homosexual acts could result in a maximum jail sentence of 14 years.
A defense lawyer for the group said in court that the defendants were mostly students, and that the group had been illegally detained for more than 24 hours, according to local media reports cited by the BBC.
LGBT-rights activists refute the police's report that the men were celebrating a same-sex wedding, saying the event in the northern city of Zaria was a birthday party.
Maria Sjodin, deputy executive director of OutRight Action International, a group advocating for LGBT rights internationally, told NBC News that the arrests were part of an attempt to suppress "an emerging LGBTQ movement" in the West African country. Sjodin said Nigeria's laws prohibiting gay marriage are being used as "a way to crack down on anyone advocating for human rights of LGBT people."
Related stories: Being gay in Nigeria