Their children gets declared illegitimate.Getting a papal dispensation during this period is hard--especially when Matilda and Stephen are first cousins.
And even if they do get a papal dispensation, the reality is that the Anarchy was going to happen in some form as soon as you get a weak king.
The problem with the immediate post-Conquest setup was that most power lay with the King and the Church, and the nobility was hamstrung. You had people owning vast amounts of land, but it was split up into 20 different pockets in ten different counties, and you just couldn't establish a power-base as a nobleman. It also led to rivalries between nobles because of unclear property divisions, jealousy, "Your guy in that village killed my guy in the next village", etc. Now, obviously, when the monarch is strong, those rivalries are subjected to the rule of the King's Law. Not so when you have a weak king like Stephen. In that case, you're going to get these rivalries building up into a civil war with two sides, with some people changing sides from time to time when they get their vengeance on one enemy and want to turn on another enemy. In fact, the first stage in what we would call the endgame of the Anarchy was when Geoffrey de Mandeville and Miles of Gloucester signed their own treaty in the late 1140s.
So you're going to get a dispute between nobles which has the end result of limiting the power of the King in relation to the nobles - and that's what we see in the basic narrative of the early Plantagenet kings as well. There are a bunch of other factors which led to the Anarchy, of course, but that was the major one, and much more important than whether women could succeed to the throne or whatever - remember, Stephen wasn't even the male heir, he had an older brother called Theobald. It was literally a case of Stephen being opportunistic enough to take advantage of the situation, and the nobles being opportunistic enough to accept a King who would allow them to carry out their own attacks on their neighbours.
So ultimately, if Stephen marries Matilda, that just changes the character of the Anarchy instead of getting rid of it entirely - maybe it happens when some rebels rally around Theobald of Blois, but remember, fifty years later, a similar situation ended in some barons inviting Louis VIII over to be King, so it's not really a matter of WHO IS THE RIGHTFUL KING.