Remove as much of the existing paint as you can by using a wire brush to scrape it away. A putty knife is also useful to cut through thick layers of paint, especially if there are multiple coats.
Smooth out the leftover paint by going over it with a belt sander. The sander will dull the edges of the paint, preventing it from chipping off later and eliminating unsightly lines once it has been painted over.
Fill any small cracks in the surface of the foundation with caulking squeezed out from the tip of a caulking gun.
Apply a latex-based concrete patching compound to any larger cracks or depressions in the surface. Use a putty knife to apply the compound to the wall and smooth it in place. Once the compound is on the wall, leave it to dry overnight before continuing to work.
Sand the entire surface of the foundation with a belt sander, including the areas you have patched. The belt sander will even out any differences in height between the patches and the concrete and abrade the surface to allow the paint to stick.
Clean the foundation and the area around it thoroughly, vacuuming all the dust and paint you've dislodged.
Brush on a coat of water-based concrete primer. By using short side-to-side,"feathering" brushstrokes, you can build up the primer coat to hide imperfections or unevenness on the surface of the foundation.
Allow the primer to dry, then sand down any high spots with the belt sander. Once you have cleaned up the dust you raised, reapply a thinner layer of primer to the spots sanded down and wait for those spots to dry.
Roll on one or two coats of paint on top of the primer. Use concrete or patio paint; this is available from any home improvement store. The roller will provide an even finish. More thin coats are better, so if possible apply a bottom coat on one day, wait overnight, then apply a finishing coat the next day once the wall has fully dried.