A stator vane is nothing but a little wing, so it is probably best to first explain how a wing works. Please follow the links over to Aviation SE for a detailed explanation. Here is the gist of it:
'A wing creates lift by accelerating the flow of air downwards. This is called downwash and is also the effect which creates the slipstream behind a spinning propeller. The stator vane is not spinning itself, but is placed into a rotating flow, such that the flow around it is very similar to that of a wing or a propeller blade.
The rotational flow component is transformed into an axial acceleration which in turn is converted into ram pressure by the narrowing flow path in a compressor. If you look at it at an energy level, kinetic (rotational) energy is converted into potential (pressure) energy.'
So the stator's purpose is to redirect the flow into straight lines parallel to the center shaft. The stators are not responsible for pressure increases in that sense but still do have some responsibility. But the narrowing compressor is the main reason of the pressure increase. The stators just help to force the flow uniformly into the smaller space. Although, the stators still do have some responsibility in increasing pressure: since air is compressible, when the fluid's particles hit onto the stators, density increases and therefore compression does as well.
The stator's purpose is to redirect flow to the next set of turbine blades by redirecting the downward flow from the turbine blades, back to the top of the next turbine. This is what as seen as an S-flow.