Robin (Cobie Smulders) was revealed to be the mystery bride of Neil Patrick Harris's character in the season seven finale of the CBS sitcom yesterday (May 14).
Speaking about the latest plot twist, Thomas explained that there had been a feeling that Robin and Barney's relationship was "unfinished".
"It had to be Robin. That's how we felt," he told TV Guide. "When they were together in season five and we broke them up... it was very divisive.
"Some fans were like, 'Great! Barney's back to being Barney. I don't want to see him in a relationship'. But there were a lot of people like, 'Boy, I feel really unfinished about Barney and Robin'. We knew at the time that we had all this other Barney and Robin saga up our sleeve."
He added: "We decided literally years ago [to marry them]. As we were breaking them up, we knew there would be a rekindling and that wouldn't be the real deal... and we would reveal them to be the groom and bride.
"Season eight is gonna be filling in the steps between 'Point A' and 'Point B'. We know they do get married, but there are a lot of steps between 'Point A' and 'Point B'."
Thomas also teased how Ted (Josh Radnor) will react to his ex-partner and close friend getting married.
"It's like at that wedding, he fully lets [Robin] go and can then meet the love of his life," the co-creator said. "There's also some stuff to play with Ted dealing with [them getting married].
"Robin's a very incendiary presence in this group's life. Robin's that girl who you can't fully put out of your mind."
How I Met Your Mother will return for an eighth and potentially final season later this year.