Yoda was the key to a lot of what happened in the pre movies. But not a lot is explained in the movies. Yoda was so powerful. And is the reason the sith had been silent for so long. The emperors plan was to weaken Yoda so he could survive an attack from him. It was one of the main points to the war. The emperor was in charge of both sides and kept the war going for almost 20 years. The universe was completely flooded with fear, death, pain, and hate. The dark side was like a poison swamp that covered everything. This made the jedi weaker and gave the emperor massive power.
Then after order 66 and all the deaths of the thousands of jedi. Not to mention this was yoda's job as grandmaster. Yoda took a personal part in the training of every single jedi that died that day. He literally helped train hands on every single one. and he felt every single death one after another. And then when he realized everything he missed his was in pieces.
That is how the emperor became powerful enough to go toe to toe with yoda. Otherwise Yoda would have taken the emperor head in seconds.