To answer this, allow me to go into a very brief description of what happens during evolution.
Now, most of you have probably noticed that a pokémon glows when it evolves. This is because there’s a sudden buildup of energy within a pokémon’s body. While most of that energy is consumed, the glow comes from the output of the specific processes that trigger evolution. It’s just that the buildup itself is the evolutionary trigger. This is also why pokémon either need to reach a specific level of strength or inner power or they need to be exposed to items that have high amounts of natural radiation of a compatible type in order to fulfill their “evolutionary requirements” (or, in other words, the specific levels of specific types of energy they need to trigger evolution). Endorphins can also present enough energy to trigger evolution, which is why some pokémon can evolve simply by being happy enough.
In other words, consider evolutionary requirements to be akin to a light switch. Most pokémon have switches that can be flipped “on” (for “evolve now”) or “off” (for “don’t evolve”). Evolutionary requirements are the specific factors a pokémon needs to have enough energy to flip that switch from on to off.
With so-called trade evolutions, the requirements are a bit different. For those species, the energy they need to evolve is typically a significant amount—far too much for many to store during their careers as battle-ready pokémon. Because of this, if you see a “trade-based evolution” in the wild, they’re typically extremely old. In other words, unless an extreme surge of energy is involved, these pokémon have evolutionary switches that are extremely difficult to nearly impossible to flip on their own, so they spend their entire lives building up that energy.
However, these pokémon may also change that switch through trading—and even then, only through specific kinds of trading. You see, just handing someone else a pokémon and reregistering it at a pokemon center (as many trainers tend to do) isn’t enough to flip that switch, but editing trainer data automatically via the digital trading system (incorporated in the GTS, the PSS, Wonder Trade, and the older trading machines available at any pokémon center) may also override a pokémon’s evolutionary requirement data with conventional data. The reason why is because for these specific pokémon—and not for any other pokémon, hence why evolutions don’t happen after trade for every species in existence—evolutionary data tends to occupy the same space as the data for their current trainer’s identity. Reregistering at a pokémon center desk allows a human to input the trainer’s identity manually, avoiding editing any unnecessary information, but doing it automatically overrides the entire block, including the part that dictates that the subject needs extra energy to evolve. (To preemptively answer a question, the reason why this trainer data needs to be edited is so that each pokémon may be officially recognized as having changed hands. Without those edits, official league equipment will register that pokémon as belonging to another trainer, which may inadvertently trigger anti-theft measures.)
Consequently, the process of editing each pokémon’s information makes it easier for them to flip their evolutionary switch from don’t evolve to evolve. Meanwhile, the extra boost of energy given to them (through the process of being converted into electricity and data for the transfer and then being converted back into matter) stands in for the energy any other pokémon needs to evolve, which results in, very long story short, evolution.
In other words, the simple answer is that trading involves directly editing a pokémon in data form and giving them an extra boost as they come out of this state, which is why they can evolve. This can’t happen with any other pokémon simply because their data isn’t formatted the same way.