Can a class IIIb 25mW 5V laser be turned into a class II 0.5mW laser simply by powering it with a PWM signal at a 2% duty cycle?
One of the requirements for laser safety is that the power output must be limited under foreseeable single fault conditions.
One foreseeable fault condition would be if the PWM signal were somehow stuck at the high level. For example, this could happen due to a software fault causing the PWM to stop switching while in the high state; or due to a physical fault like a bit of wire falling between the pwm signal wire and a power supply wire.
If you added sufficient safeguards (maybe fuses or clamp circuits) to ensure that such faults couldn't result in an unsafe laser output power, you could probably get your system certified as class 2.
(Note that current practice uses "class 1", "class 2", etc. The old ratings in "class I", "class II", "class III" are obsolete).