Ross and Rachel had gotten drunk and had their faces drawn on and drunkenly got married. Monica and Chandler were also about to get married in Vegas in one of the wedding chapels, but quickly changed their minds when they saw Ross and Rachel stumble out of the chapel.
The wedding had no proper planning and preparations, no guests, no vicar.
The wedding was seen again in the season 6 premiere and later Ross and Rachel have no recollection of what they had done until their friends remind them.
Rachel wanted to end the marriage, but Ross didn't because he didn't want to be divorced a third time. When Rachel asks him if he got an annulment, Ross lies and says yes and stays secretly married to her. - The One Where Ross Hugs Rachel (S6E2).
Ross also offers Rachel to move in with him after Rachel has to move out from Monica because Chandler is moving in with her. Soon Rachel finds out that she's still married to Ross and gets furious. She storms into Ross's paleontology classroom at New York University where he had recently gotten a job as a college professor of paleontology and is mad at him. The One Where Joey Loses His Insurance (S6E4).
They then go to a judge where they have a court date and try to get an annulment, but fail to because Rachel filled in false information about Ross and also because of their previous relationship. They are forced to get a divorce and they both want an annulment, but are forced to leave when the judge asks them if they would like to spend the night in jail after Rachel threatens the judge and Ross rips paper out of the court reporter's machine.
At Ross's apartment, they fill out divorce papers Ross picked up until Rachel confesses that it was her idea to get married. They then come to terms and Rachel forgives Ross when she realizes the reason of why he didn't get an annulment earlier. They hug and Ross gets the papers to his lawyer's office. - The One With Joey's Porsche (S6E5).
After the series
It is assumed that Ross and Rachel married again after the series ended, as mentioned by Joey in the spin-off Joey, only this time having a proper wedding with guests, decorations, a vicar and everything.