Small cracks in foundation walls may be sealed with caulking, cement or expandable foam.
If you can, monitor cracks to see if there's any movement or change in size, and consult a structural engineer if you see any evidence of such.
In most cases, larger cracks should be evaluated by a structural engineer.