The Dark One says Emma brought the sword to SB to reunite the 2 pieces, but in Camelot Arhur had it. So, obviously it can't be Emma the one who put it in the stone again, I think it was Merlin. Right? He did that to prevent the Dark One from taking it. Emma probably got mad and did... something to him during those weeks. Now she needs a hero to release Excalibur.
Given that Merlin gave a very young Emma the warning about pulling the sword from the stone, I'm leaning toward Merlin being the one to replace the sword, or possibly even Nimue.
Slightly off topic, but maybe, just maybe, Merlin and the Apprentice are not a good as we have been led to believe. Remember that the Apprentice wand needed light and darkness to travel realms (and probably do other of the more powerful things that we have seen). and according to the Apprentice, the wand contained only light, which means that the Apprentice had to be the one supplying the darkness.
The off topic comment is to say that I am betting that Nimue originally crafted Excalibur (possibly with Merlin's help) to pull darkness out of everything, and when Merlin went dark, Nimue placed the sword in the stone until someone worthy could pull it out, after using the end of the blade to get control of the darkness (and creating the orignal Dark One, which I am guessing now to be Merlin himself). And also trapping Merlin in the Tree.
Nimue came back and took the sword in order to protect it, and Emma used her power to bring the sword and everything else to Storybrooke (except Nimue was deliberately excluded). Just supposition.