The accused, aged 20 to 30, appeared at a magistrates court in the northern city of Zaria, Kaduna state, Wednesday after being arrested at a hotel where they allegedly attended the wedding, clerk Mahmud Bello said.
The suspects were arrested on April 15 and have been charged with conspiracy, unlawful assembly and belonging to an unlawful society, the clerk said.
Bello added that the couple managed to escape.
The suspects, mostly students, pleaded not guilty and were released on bail while the judge adjourned their case until May 8.
"Information reached the police that this group of persons conspired to celebrate a gay marriage," said Bello, reading from the charge sheet.
Nigeria operates secular and Islamic laws, both of which prohibit gay relationships
In January 2014, the country passed legislation under former president Goodluck Jonathan making gay relationships punishable by 10 to 14 years in prison.
Sharia laws operating since 2000 in 12 predominantly Muslim northern states provides for the death penalty for people convicted of homosexuality.
Several cases have come before Sharia courts which have yet to convict anyone of the crime.
Many suspects have been acquitted or released on bail, their cases stalled by technicalities.
In one prominent case in January 2014 more than a dozen men were charged in the northern city of Bauchi, leading to violent protests outside court by angry mobs demanding death sentences.
Police fired warning shots in the air to disperse the crowd.
The suspects, some of whom pleaded guilty, were released on bail and the cases dropped.
Despite the lack of convictions in such cases, the anti-gay legislation has created a climate of fear, according to Human Rights Watch.
WATCH: Deep Water: Gay bashing survivor Ron Harmer