There are several ways to express this depending on what you're trying to say:
"Now, several years have passed, and I can still remember the punishment for no reason." This means that you can still remember this specific punishment, but you can't understand why you still remember it.
"Now, several years have passed, and I can still remember being (or getting) punished for no reason." This means you were the one who got punished even though there wasn't a reason as to why you did.
"Now, several years have passed, and I can still remember the punishment that didn't have a reason." This could mean you were the one punished, or it could mean someone else was punished. Either way, neither punishment had a reason behind it.
I hope my answer helps. Please let me know if it doesn't. 我也可以用中文帮你解释。