You should take a look at the command xpmroot. If you have a wallpaper picture.png in your current workingdirectory, simply execute
to set this wallpaper. But xpmroot does not support jpg, read the manpage. Take also a look at the xsetroot command.
You can use the commands in a script which automatically sets a new wallpaper after a specified amount of time.