If it’s for a game, then the best solution is to do it in-engine, by storing the previous N frames and where they were drawn, and rendering them at a lower opacity. That’s how it’s usually done in games, as it’s more flexible and keeps the original assets simple and small.
If you need to do it for an art piece, then I think the easiest way is to make a few layers that contain your animation below your main layer, as many layers as you want afterimages, and then cut+paste all their frames over by one, and keep doing it by one more for each subsequent layer. Then, lower the layers’ opacities with the furthest-removed layer being the faintest and you should get this effect.
This approach works best if your framerate is consistent and relatively fast. If you have a lot of held frames, you’ll want to split them up first, you can use the Frame Rat script for that. This method is easiest if your animation is already finished, so you can mass-paste all these frames. If you want to preview this effect as you go, you can create your afterimage ahead of time, and copy the frames onto them as you draw them. Quite a bit more hassle.
This seems like something that would be easy to script, but I haven’t seen a script for it, I guess probably because it’s usually done in-engine rather than in the image editor.