osgDB is the library for read/write scene graphs in different formats, and there's an OSG plugin to read/write scene graphs to STL format.
First, you need to build OSG linking to VRLM library, in which OSG depends to build de STL plugin. If you are using CMake, the keys are: OPENVRLM_INCLUDE_DIR, OPENVRLM_LIBRARY and OPENVRLM_LIBRARY_DEBUG. After a successfull build, you will find the builded plugin at bin\osgPlugins-3.0.1
Then, you only need to read the .osg scene graph and write the .stl scene graph. Something like this:
#include <osgDB/WriteFile>
#include <osgDB/ReadFile>
...
osg::ref_ptr<osg::Node> node = osgDB::readNodeFile("node.osg");
osgDB::writeNodeFile(node, "node.stl");
...
osgDB will select STL plugin based on the file extension (.stl).