I don't know.
The Bible doesn't state their specific sins, but I think there is one thing we always know with the killing passages. The wages of sin is death. Everyone that dies is dying as a result of being a sinner. When I die it will be because of my sin. When you die it will be because of your sin. The boys died, because they were sinful and they would certainly grow up to be even more sinful than their parents. It is the tendency of generations to surpass the previous ones in wickedness. God stopped it. The other side of the coin is why does God NOT kill an entire camp when clearing it out of the land of Canaan? They were terrible people! Their camps were full of murder, rape, incest, and child sacrifice. The poor kids right? Wrong, they were going to grow up to do the same thing! The adults doing those wicked deeds were once kids too!
I often think of Hitler when reading passages like this. What would I have thought if somehow I knew that God killed a little baby in Austria? I might be tempted to feel upset, but I don't have the foreknowledge of God in all his actions. Yet, if I knew who it was, I might be tempted to rejoice that the baby died, because that baby was just an undeveloped mass murderer. Why is it ok when God does that and not Hitler you might object? Because no one has the right to sentence but a judge. Here's the simple truth: God would and will be completely justified in destroying this whole wicked world. He knows the innumerable sins of man. However, what has He done rather than just kill everyone? He sent Jesus Christ to pay that price of our sins. Jesus Christ was killed in our place. If you're a Christian, you would be like the Midianite boys, but because of Jesus, you are given eternal life with a loving God instead. Repent and believe the Gospel. Praise the Lord.