Many teenagers joined the Union or Confederacy to fight for their beliefs. For example, Northerners were primarily abolitionists, and Southerners agreed with the idea of slavery. Teenagers joined the army to fight for these purposes.
Personally, I believe that it was unnecessary for teenagers to join the army at such a young age. It cost them many lives and they were not needed/drafted into the army.