It neutralizes the developer, and stops it from working any more than it already has. It also lengthens the useful life of fixer (the next step in B&W developing) by preventing the alkaline developer from contaminating the acid fixer. In B&W print development, it serves that purpose more so as a properly, exactly exposed print does not need a stop bath to arrest development.
If you're running Process E-6, it has another function. (Note: the official Kodak E-6 process doesn't contain a stop bath after either developer, but I use one after the first developer.) The second step in six-step E-6 is reversal bath. Kodak's reversal bath liberates a LOT of gas if you use it with no stop bath beforehand, and it will blow the cover off your tank.