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. Take note that the arrows are one-way; a Pokemon cannot be transferred against the direction of the arrowhead (and where it can be transferred both ways, a second arrow going the opposite direction is included). Please credit me or PokeBase if you re-use this chart.
^ The only exception, as sumwun mentioned before me, is that transferring Pokemon from Gen 2 to Gen 1 is possible if the Pokemon is present in Gen 1 and it knows only moves present in Gen 1.
* Virtual Console games could be considered part of Gen 7 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.