It is not possible to transfer Pokemon to a game that is from a previous generation^. This applies even if the Pokemon was originally transferred from a game belonging to a previous generation. However, Pokemon may be transported to and from Pokemon Home and Pokemon Bank depending on your game. It is also possible to trade Pokemon between main series games of the same generation**.
Refer to the flowchart below to see where your Pokemon can go. (Please credit me if you re-use this!)

^ The only exception, as sumwun mentioned before me, is that transferring Pokemon from Gen 2 to Gen 1 is possible if the Pokemon was present in Gen 1.
* Virtual Console games could be considered part of Gen 7 in some ways, because Pokemon from them cannot be sent to any game prior to Gen 7.
** LGP/E is considered to be part of Gen 7, but it has no interactivity with other Gen 7 instalments in the series. Pokemon in LGP/E can make a one-way transfer to Pokemon Home or be traded between copies of LGP/E.