In any castle you have empty slots 3/castle where you can store your troops, and save them for later use.
If you`re sure you wont use that troop type later, double click on troop icon in hero menu, and then `dismiss`, you`ll be asked how many units you want to dismiss and you chose all and enter. There you have 1 more empty slot.
Also there is sill in mind tree that allow you to lead more troops, and change whole army composition between battles. So you have 5 active stacks(or less if you dont want to lead full army) and plus 2 max in reserve. In those slots you can lead more unit types already in your army for later to fill in casualties after battles, so you dont have to run back to shop after every couple of battles for restock.
Have fun