Is it legal to exchange gold with someone between SoD and retail/cata?
legal yes (but only if its clean gold from someone that is not in any way shape or form connected to buying or selling gold and blizzard wont step in if you get scammed but they will ban you if the other person is a gold seller/buyer)
It is, but at your own risk. Blizzard will not move a finger if you trade with someone untrustworthy.
Also make sure not to trade with potential gold-sellers or bot players as trading with them can get you perma-banned with little to no hope of appeal.
There are also discords available to meet with players wanting to trade gold between servers.
You have to be very, very careful with whom you exchange it, if it goes wrong you are left with nothing.
So many of those advertising in trade or general will cheat you out of your gold.
I have a lot of gold in retail and I would swap it with someone for SoD PvE gold but most of those advertising it will scam you and the rate is dire.
It is as others have told, an unsupported transaction. Any trade is done at your own risk.