Train your units first (fighting bandits and simply leveling them up with the passive Training skill), make sure you have a lot of archers too and when in battle, order them to hold their shot until the cavalry has gone past their half of the battlefield, and then order your archers again to shoot at will, to make sure they only target the enemy cavalry which has most likely left their footmen behind themselves. If you play with Rhodoki units or fight for the Kingdom Of Rhodoks, it is explicitly told to your characters in a few dialogues that the Rhodoks fight defensively and in an unorthodox manner: let's keep aside the fact that the AI is too stupid to use their glaives as thrusting weapons to stop a cavalry charge, everybody knows that already, and consider the fact that the rhodoks exploit their mountainous environment to their advantage to nullify the enemy's advantage of a cavalry charge or simply the speed of mounted units.
Either drag the fight into a hillside or among the mountains, or enter siege fights (either defensive or offensive, in both cases neither party will have horses so Swadian Knights and Mamelukes are an easy target for ranged units).