All you need to do is look down at your horse and hold the “F” button to get off of it. You have a chance to choose if you want to mount or dismount your horse during combat. During combat, you may want to fight on a horse, but if you also may want to change your strategy and attempt to dismount, fighting your enemies using your two feet.
Combat is a common practice in Mount and Blade II: Bannerlords. A majority of the time, you and your army will start a campaign with a horse available to you, making it significantly easier to travel between destinations.