The problem is that wmctrl needs to talk to the X server. So you don't want it to run at startup (at least not when rc.local runs), you want it to run when the X server launches. In addition, you need it to know what DISPLAY it should be talking to.
Raspberry pi autostart of LXDE does not work has background information about starting programs when the X server does. It appears though that when the autostart script fires, the desktops still aren't ready for wmctrl to control. So the best thing is to write a small script that introduces a short delay. I used 10 seconds and it was fine. You could probably get away with less most of the time, but I wouldn't think you'd need much less.
Create the script and make it executable. I placed the script in the user's "bin" directory
mkdir ~/bin
printf '#!/bin/bash\nsleep 10\nwmctrl -n4\n' > ~/bin/wmscript
chmod a+x ~/bin/wmscript
Tell the X session to run the script. Add the path to the script with an @ symbol at the beginning of the line.
printf "@bin/wmscript" >> ~/.config/lxsession/LXDE-pi/autostart
Now the next time you start an X session (logout or reboot), it should set your desktops a few seconds after login.