Much like a big-kid's version of the Massachusetts law forbidding marriages illegal in other states of the United States, the Catalonian Supreme Court of Justice slammed the guys. Like our states, nearly all nations like to respect each other's laws, in the full-faith-and-credit posture. The problems come when something, like polygamy, is illegal in one country.
In the case of the informal Spanish ruling, the men can appeal to the Justice Minister. From here it looks like the one fellow can turn in his Indian passport, get a local one, and then pony up for a license.
There is a certain elegance to pinheaded bureaucracy. It's like playing Simon Says.