Oh dear... this is easily one of the most misunderstood areas of Islam, because it's hardly taught correctly (in general) and it has slightly unique rules too, given the unique relationship of marriage.
The Prophet (saw) said that there are three matters in which it doesn't matter about your intention; nikah, talaq and taking one's wife back after a revocable divorce (I'm paraphrasing the hadith).
Basically, this means, even if you were joking around about marriage or divorce... so long as the other factors are present, the process has been enacted as far as the shariah is concerned. Thus, for a man to joke about that he's divorcing his wife, it doesn't matter whether he was being serious or not... the fact that he treated it as a joke is sufficiently serious enough to trigger the process.
Here's the scary thing... how many people do you think don't realise this? How many of them are still in a marital relationship, yet they're actually divorced in the eyes of Allah and are thus committing zina? How many children have been born into these relationships? And what will their reaction be on the Day of Judgement when Allah (swt) reveals the true nature of what they have done.
Ignorance about your own religion isn't an excuse!
Now, here's the other misconception about talaq, which is that it has to be pronounced three
times. Don't do it!
The correct way to pronounce a talaq is as follows:
- The wife must not be on her menses
- The huband must not have been intimate with her since she last came off her menses
- He must make one clear unequivocable statement of divorce
And that's it... the divorce process starts. For the first and second time, he has until she finishes her third menstrual cycle to revoke it (and he can do this privately himself, he doesn't need to tell her), but it's important to realise that she's still his wife until this time. So she stays in the marital home, and she should try to charm him again.
If it's the third time he's done this, she ceases to be his wife immediately (because he can't revoke that one), so she has to wear the hijab immediately and leave the marital home.
Btw... if any of those rules I've listed above are broken, it doesn't invalidate the talaq. It just means the husband incurs a huge sin for doing it wrong, but the talaq still counts.
Now, there is some confusion as to what happens if the husband makes three statements in one go. Does it count as one divorce, or three? I'm not going through the whole fiqh on it, but suffice to say that at the time of the Prophet (saw), someone said it three times but the Prophet (saw) counted it as one (and the man got reprimanded). But during the time of Umar bin Khattab, because of it being abused, he made three statements at the same time count as three divorces, to stop people playing around with it.
I believe the Hanifi madhab still go with this opinion. I prefer the opinion of counting three as one myself for various reasons. So in this instance, the couple in question could be married... the problem is now due to ignorance they may never know.
(p.s. talaq shouldn't be pronounced once a month for three months either... once it's pronounced, that's it! Unless of course it's revoked later for the first or second time)