In the way of the world, and coincidences, my friend's ex and father of her child was sentenced to two years this week. He was caught in a sting operation for grooming a minor (15 male online). However, with the sentence there must have been more to it.
Everyone in tears, but we did some immediate crisis management. The party line is computer fraud, to protect his children.
I was then caught thinking if this were my dad, brother, child what would I do? How would I separate the love etc. There was an excellent post earlier by a PP stating the ritualisation of prison visits etc and I think that helps give a framework.
Also, you are in early days. There is a shitload to unravel and work out ( counselling?) But you do have time. No-one is entirely evil and visa versa. And humans have typical behaviours and your son is just one of a number. Disappointing, heart rending but, sadly, a human story.
Take your time, feel your anger and hurt and your deep sadness. Do what you need to do, until a pattern that you can cope with emerges.
I feel for you and other PP on here who are.going through similar. You are not alone, though the shame and distress may feel like it.
Take good care