Merging all layers can be done with gimp-image-flatten (but this also removes any transparency).
The equivalent to the "slice using guides" in the UI is plugin-guillotine
gimp-file-save saves the image in whatever format is given as an extension (so as PNG if the file names ends with .png). You can also for a PNG save with gimp-png-save or file-png-save2. Note that all the save operation to "flat" files (PNG, JPG...) only apply to the specified layer.
This said, I have the gut feeling that this is the wrong way to solve a problem. If you can explain the original problem we can come up with better solutions, perhaps with scripts that already exist. For instance a script of mine will cut an image in regular "tiles" and save each tile to disk (so this would be your "slice and save") and another one can save/export all the layers (so this would be you "flatten, slice and save").
The equivalent to the "slice using guides" in the UI is plugin-guillotine
gimp-file-save saves the image in whatever format is given as an extension (so as PNG if the file names ends with .png). You can also for a PNG save with gimp-png-save or file-png-save2. Note that all the save operation to "flat" files (PNG, JPG...) only apply to the specified layer.
This said, I have the gut feeling that this is the wrong way to solve a problem. If you can explain the original problem we can come up with better solutions, perhaps with scripts that already exist. For instance a script of mine will cut an image in regular "tiles" and save each tile to disk (so this would be your "slice and save") and another one can save/export all the layers (so this would be you "flatten, slice and save").