Department or army commanders normally decided if an artillery or cavalry regiment was to serve as infantry. When warm bodies were needed somewhere, troops standing idle were liable to find themselves handed a rifle-musket and repurposed to whatever new role had been thought up for them. The War Department would not be involved unless the move required an inter-departmental transfer. Since unit designations (*) were rarely changed, this should not have affected pay or pensions.
(*) To cite several examples.
The 14th New York Regiment of Artillery ( Heavy) always retained that designation even when serving as infantry.
From an earlier conflict, the Regiment of Mounted Riflemen found itself employed as infantry during the Mexican War because they had no horses on which to be mounted. They remained designated as Mounted Riflemen until 1861 when they became the 3rd Cavalry.
In the Second Seminole War, the 3rd Regiment of Artillery served in Florida as infantry. Their unit designations never changed.