If a Pokémon is holding an Electric Seed while the field is Electric Terrain, it consumes the Electric Seed and its Defense is increased by one stage. The Electric Seed is consumed even if the holder is not otherwise affected by the terrain (i.e. it is not grounded or in the semi-invulnerable turn of a move). It is not consumed if the holder already has +6 Defense stat stages (unless its Ability is Contrary, in which case it won't activate if the holder has -6 Defense stat stages).
If the terrain is changed to Electric Terrain by Electric Surge, then immediately changed by another terrain-changing Ability, the seed is consumed before the other Ability activates. Magic Room and Embargo fade before terrain does, so if Electric Terrain would dissipate on the same turn as Magic Room or Embargo, the seed will activate before the terrain dissipates. If multiple Pokémon each hold an Electric Seed when the field becomes Electric Terrain, each Pokémon will consume the Electric Seed before Symbiosis transfers any item (including Electric Seeds).
If a held Electric Seed did not activate because its holder's Defense is already at +6 (or -6 in the case of Contrary), it will not activate for its current holder until the terrain is changed or its holder takes damage (unless the holder is switched out).