If the marriage takes place, would Charles be sent to Scotland to live with Mary of happens the contrary, with Mary going go live in Madrid? And assuming that she goes to Spain, wouldn't it cause someone in Scotland taking her throne? After all, she lived pratically all her life in France (and later in Spain), was a Catholic, and now she is married to a Spanish Habsburg.
The point of the marriage was to guarantee Scottish independence, the thinking being that Scottish independence could only be guaranteed if Scotland had a continental sponsor powerful enough to balance out England. France was traditionally the continental sponsor that fulfilled the above role.
If Mary is married to a Hapsburg, then that would signal a significant departure in Scottish foreign policy, since it would mean the end of the traditional Auld Alliance. This marriage, if it produces children, would be interesting, since it would align Scotland with Spain, which is hostile to England, but also hostile to France. And ultimately the Spanish rivalry with England was a short-term feud, compared to the centuries long struggle between the Hapsburg and the French. France's power ultimately was what dictated the European alliances.
Charles would need to live in order for Mary to marry him. His frailty and apparent bouts of madness would hedge against him living long enough to father children (if he was even capable of it). But, this is althist. So Charles lives and marries Mary and they have children. Those children will be able to inherit both Spain and Scotland, and thereby unite the realms. Something that is not going to be popular in Calvinist Scotland one imagines.
I tend to think that if Mary had a male child with her OTL French husband, the English would end up invading and controlling Scotland, either through an out-and-out invasion, or through supporting a Scottish usurper. With OTL history of bad blood between Philip II and Elizabeth, I can only think that Elizabeth would view overthrowing Mary's regime in Scotland (whether or not she was actually ruling in person) as very important.
If Mary has a surviving male heir with Charles, then Elizabeth is definitely going to cut Mary out of the succession. I think that Elizabeth I would probably go by her father's will, which would mean that her successor would be the descendents of her aunt, Mary Tudor (Queen of France). I don't know how that would shake out, but I think Elizabeth would take a much keener interest in the marriages of her cousins. With the threat of Mary, Queen of Scots, Hapsburg son the court politics of Elizabeth may be even more cut throat. Elizabeth and her advisors might be able to come up with a plan that allowed them to both secure Elizabeth's succession and remove Mary, Queen of Scots, from the throne of Scotland, by advancing a member of Margaret's (Queen of Scotland, sister of Henry VIII) line to the Scottish throne, and naming that person as the heir of the English throne as well. If someone like Arabella Stuart (I guess it would be Stewart, no French-influenced name change, right?) from OTL were still born, then she would be the prefect candidate for this kind of plan. It would probably require some kind of military force however, if only to support the pro-English Scottish nobles who want to overthrow Mary's rule.