Immunity/resistance would be applied before the damage transfer
Note the timing of the damage mentioned in the Shield Guardian's text (MM, p. 271, bold added)
If the guardian is within 60 feet of the amulet's wearer, half of any damage the wearer takes (rounded up) is transferred to the guardian.
A character hasn't "taken" damage until all the modifiers to damage have been factored in. For evidence of this, note the text on resistance and immunity in the PHB (p. 197, bold added).
Resistance and then vulnerability are applied after all other modifiers to damage. For example, a creature has resistance to bludgeoning damage and is hit by an attack that deals 25 bludgeoning damage. The creature is also within a magical aura that reduces all damage by 5. The 25 damage is first reduced by 5 and then halved, so the creature takes 10 damage.
This description implies that the following three things happen in this order:
- an attack or effect "deals" damage
- Immunity or resistance reduces the damage
- target "takes" damage.
Since the shield guardian transfers damage that its amulet's wearer "takes," it will transfer damage after the resistance/immunity had been applied.
As an example, in the case where the target (wearer of the amulet) has immunity to fire damage, an effect would deal fire damage, and then immunity would reduce that damage to 0. At that point, either your DM would say "your character doesn't take damage, so the Shield Guardian's effect doesn't activate" or would say "your character takes 0 damage, and half of 0 (rounded up) is 0." Either way, the Shield Guardian would take no damage if the wearer of the amulet was immune to that damage type.
Resistance would work similarly. If you are resistant to a damage type and are dealt damage of that type, your resistance would reduce the damage, then you would "take" the damage, but half of the damage "taken" would transfer to the Shield Guardian.
As a final corroboration, Jeremy Crawford has confirmed this reading.
If you have a shield guardian, half of any damage you take is transferred to the guardian—that's half of the damage you actually take, after resistances and the like.