You can only trade with games that are in the same Generation as each other (e.g. Gen 5 can only trade with Gen 5, Gen 3 can only trade with Gen 3). Two main reasons are:
- Stats worked differently in Gens 1 and 2, so trading an old Pokemon to a later game would break a few things.
- You would be able to trade Pokemon from a newer game that were not programmed into an older game.
- Older games that work only on old consoles have no way of communicating with newer games.
You can migrate Pokemon from Gen 3 to Gen 4/5, but they cannot be sent back once done. You can also transfer Pokemon from Gen 4 to Gen 5, but Pokemon sent cannot be sent back.