If you look at the number of drummer boys and cabin boys that served on both sides, I would be surprised if you could quote contemporary legislation which prevented their service. There are many famous examples - that of Johnny Clem coming first to mind.
A drummer is a different role entirely from that of a soldier. As for governing laws, one need only look into those of the contract which have governed underage minors in more or less the exact same way dating back to colonial days. Specifically, an underage minor retains the common law right to disaffirm a contract he enters into prior to a certain age (normally 16 or 18), the idea being that he isn't of age enough to be bound under the same standards as an adult. By this same principle, if a 16 year old kid walked into a car dealership and tried to purchase a new corvette they'd send him away or require an adult to sign the title as well - even if he had a suitcase of cash to pay for it - on the basis that he could technically disaffirm it at a later date before turning 18 and get every cent he paid back.