Passing time without any knowledge or memory is probably the main reason to be taking drugs in prison. Yours sounds like the perfect, side-effect free solution!
On the flip side, a drug that let you retroactively forget would be heavily used I bet. Traumatic experiences are often wished to be forgotten. Though, I wonder what a human would be like if they didn't have negative experiences. One who was able to remove a big portion of mind shaping experiences. Further yet, I wonder if your mind ever truly forgets. If a dog bites you as a kid, and then you take the forget pill, are you still afraid of dogs?