Sure you can. Clinton and the Democrats did it twice.
Once when they made the tax increases retroactive and the second time when they passed the Violence against Women act and made past Domestic Violence convictions, admissions of guilt, and pleas of No Contest fall under the law for the person not being able to own any firearms.
There were reports of Police Officers and Military who were retroactively affected and lost their jobs because of it.
A change in tax rates is not a punishment for a crime, nor are restrictions on gun ownership by convicts.
So you seem to be saying that if Congress makes any form of child abuse an automatic death penalty, anyone in the past who has been convicted, plead guilty to, or even plead No Contest, to child abuse, they should be all rounded up and killed.
Am I right?
After all, Additional punishment was added to the punishment assigned by the court in those cases and Domestic Violence is often not a felony charge or a Class 5/D Felony. Yet by Federal law, once convicted, or if they had ever been convicted prior to the passage of the law, they lost their 2nd Amendment Rights.
You're not even close to right.