You may wonder how a sane child would do these things in the first place; but they are often drugged, tortured, and/or threatened. After the war is over, they are often left disabled, mentally traumatized, homeless, orphaned, and with no where to go.
Also many children are already orphaned or refugees to start with and feel they have to join army because it is their only way to survive. They already have no parents and/or no real home, and now they have to battle in war. It's horrible and sick and wrong, but sadly, it's happening...