Cavalry and artillery can only be created if the Fortress is upgraded with Build stables or Build artillery depot. Most factions have both combined as one single upgrade. (Spain and Germany have to research both separately).
Like the Fort, the Fortress can shoot with cannons at enemies once there are units deployed inside it. This can be risky at times since they can also hit and set ablaze your own or allied buildings if they are in the way.