We can't answer that for you...
You have a few questions to ask yourself and reach a conclusion:
1. Is he really a friend, or more of an acquaintance?
2. Since he's young himelf was the charge really that big of a deal? Like did he have nekkid 12 years old on his PC(or whatever), or more like some 16-17 years old girl send him nudes.
3. Does it bother me that much that he's in jail?
4. Do I want to continue our relationship after we get out?
I was in a similar situation with you a few years back, with a friend that got busted for smoking weed with a few minors, and I pussied out and didn't visit my friend in jail, now we barely speak anymore, which I regret cause we were really good friends before.