I know in a casual setting it's probably considered unsportsmanlike conduct, but let's say I was in some sort of tournament and I played a card that said I have to flip a coin. Would a judge issue me a penalty if I flipped a two headed coin?
Yes, it's of course against the rules:
So yes, it's illegal, and you can most definitely get a penalty, presumably something severe for cheating (as Hao Ye points out in the comments). You could get disqualified for cheating just for deliberately miscounting damage to your advantage. Rigging a coin toss is pretty blatant and disrespectful, and I can't imagine judges (or anyone else in the room) having much sympathy.
And even if the rules somehow had a loophole allowing it, this would of course be incredibly poor sportsmanship in a tournament. Casual play isn't the only time you should respect the people you play with.