I assumed the main reason is that cavalry can trample one or two men, and ride beyond with most of their speed. But, they would lose their momentum against a square formation and be lost.


Also, the square formation was obsolete at the beginning of the American Civil War even before breach loaders appeared.