My theory is that they built something around this electromagnet. There was an incident, which caused the electromagnet to charge with power. In order to discharge this power (before it gets to be too much) you have to punch in a code. This discharges some of the electromagnetism harmlessly. If you fail to push the button, the field will grow and grow, and get stronger and stronger (maybe sucking everything into it?). There is a fail safe which will discharge all of the electromagnetism at once, so no need to push the button anymore once this is done.
So why not just do that to begin with? I think the electromagnetism has something to do with the island's healing power. It's best to keep it on so they can experiment with it. Now that the electromagnetism is gone, perhaps Locke will begin to lose the feeling in his legs. Perhaps Roses' cancer will come back... Theory 2 is that, the electro-blast we see was so powerful, it permanently cured them (so we won't have to worry about Locke not being able to walk anymore eventually, or Rose dying eventually from the cancer).