Can a corps or army be upgraded

In short: Yes you can upgrade any unit(s), whether they are alone or in corps or in an army, at any given time (granted you have sufficient gold to do so). The cost of gold scales with units (it costs about the same to upgrade each individually or as a whole army at once).

Worth noting: Some units upgrade path ends before others. (E.g. You can only upgrade recon units so far before they run out of newer/stronger versions higher up in the tech tree vs something like infantry units that upgrade further into the tree.)

Beginning at the Renaissance Era, two of the same units can be combined into a Corps, which is less powerful than two individual units, but more survivable and takes up less space on the map (to reduce overcrowding). Additionally, in the Modern Era, three units can combine to form an Army. The ability to form Corps and Armies are unlocked in the Civics tree rather than the Technology tree.

Taken from here. (Worth noting that corps/armies do not have their own pages on the wiki.

In your particular scenario, you will have to upgrade the units to match each other before combining them. You cannot combine a musketmen with a crossbow, they still need to be the same unit/unit type (ranged, recon, artillery etc).

About upgrading:

A unit can upgrade to a new unit type when the following conditions hold:

  • The new unit type is an allowed upgrade for the unit
  • The civilization has the technology allowing the new unit type
  • The civilization has enough money in its treasury to afford the upgrade cost
  • The unit has not expended all of its movement points that turn
  • The unit is within its own cultural boundaries
  • The city (of its civ) that the unit is nearest to has access to any strategic resources necessary to build the new unit type

  • When all of the conditions above hold, you will see an "Upgrade to X" button lit up (active) when you select a unit that can do that upgrade. When you have the technology that allows an upgrade, but one or more of the other preconditions do not hold, then you will see an "Upgrade to X" button but it will be darkened (inactive).

The cost for a human player to upgrade a unit is computed based on its hammer cost compared to the hammer cost of the new unit type, as follows:

Cost = 20g + 3g * (hammercost(new) - hammercost(old))

For example:
Upgrading musketmen (80 hammers) to riflemen (110 hammers), costs 110 gold.

When a unit is upgraded, the following effects happen:

  • It is replaced by unit of the newer type. Its hitpoints and promotions are not changed.
  • It loses any inherent abilities of the old type, while gaining any inherent abilities or promotions of the new type
  • It loses all remaining movement that turn and is unfortified
  • It has its current experience decreased to 10, if it has more than that (Does not happen if it has a merged Great General)