Clear away any loose stone, mortar chips, dust, dirt, moss and other loose material that is in or on the crack. Use a wire brush, putty knife, vacuum or pressurized air hose for best results. Leave only solid stone and solid mortar, otherwise your new mortar will be bonding to loose bits and won't solve the problem.
Wet the area with a spray nozzle on a hose. Make all the surfaces damp, but don't create puddles. These damp surfaces will cause the new mortar to cure more slowly, which will increase its strength.
Mix standard joint mortar, available at any hardware or home improvement store, with water, according to the instructions on the mortar bag. Push the mortar into the crack and into any joints between stones that have lost their old mortar, using a trowel. Fill the crack and joints completely with mortar; don't leave any gaps in the middle of the wall, as these gaps could fill with water, which might later freeze and re-crack the wall.
Repoint the joints around the stones with new mortar. Repointing is the act of going over damaged and worn mortar joints with fresh mortar. This task will retain the original appearance of the wall. If you are not concerned with appearance and want to maximize protection of the stone foundation, parge over the entire surface with parging mortar, covering the surface of the stones and decreasing the risk of water infiltration into the stone foundation wall. Parging is the process of covering a surface with mortar rather than just using the mortar in joints. To parge a stone foundation, spread the parging mortar over the surface of both the stones and the joints with a trowel. Pass the trowel over the surface repeatedly to create a smooth surface that is free of irregularities and gaps.