Shadow Mapping and Screen-Space Ambient Occlusion solve different parts of the rendering equation because they make different assumptions.
As the name says, Screen-Space Ambient Occlusion assumes that light is coming equally from every possible direction above the hemisphere of our sampled point towards that point. That is, in order to solve ambient occlusion, we need to integrate a constant function (the irradiance) over the hemisphere of the sample point to determine the fraction of the hemisphere's solid angle that is occluded from the ambient light source.
And also in the word Screen-Space Ambient Occlusion there is the phrase "Screen-Space". It means, the computation, that we do in order to compute the fraction of the sampled point's hemisphere occluded from the uniform ambient light source, is only based on information we have ready available in screen-space (and not world-space by e.g. doing analytic ray casting/tracing of scene geometry - which we could do of course, but then it won't be called Screen-Space Ambient Occlusion anymore).
So, Ambient Occlusion (which Screen-Space Ambient Occlusion is a way to approximate that based on information we rendered into screen-space):
- assumes that light is coming equally from all directions over the sampled point's hemisphere
- approximates the occlusion factor (fraction of solid angle over the sampled point's hemisphere that has no incident light from the ambient light source)
On the other hand: Shadow Mapping. This is a technique that makes a completely different assumption about the irradiance incident to our sampled point. Here we do not assume light coming equally from all directions above the hemisphere of our sample point, but assume that light is coming from a single direction (or a small solid angle around that direction when we approximate soft shadows).
In order to solve that, we can sample the scene from the light direction and then test whether our sampled point could have received light from that light direction.