How come Abra was able to evolve in episode 22?
In the anime, evolution is a bit different to evolution in the games. For example, Pokémon do not evolve when traded and can refuse to evolve.

If you look at the list of evolution in the anime, you'll find many Pokémon that did not evolve after a battle. It's more like they constantly gain experience and can sometime decide that they want to evolve now, mostly when it's needed. Also, the idea of "levels" aren't very much used in the anime, so I don't think it really matters. It's just a mixture of emotions and experience.