Well, i have seen officers & soldiers having nothing to do with religion till their retirement, but when u meet them after a few months or years, they become fundamentalists.
Then there are some who get into religion more after having gone through some personal traumatic experience, changing their life forever or having a considerable affect on it, its either in service or outside of it.
Then there are some who have nothing to do with religion, but when they go through the tough army life and near death experiences, the come near to religion, some become pure fundamentalists and some partially follow the fundamentals of Islam.
And some, who come to army from the start as people following their religion.
Some even get influenced by the other people who are into religious things.
So from where the journey turns into extremism from fundamentalism is what should be explored.
But in our case right now, most of these officers & soldiers are the the ones who got influenced by these extremists during the Afghan Soviet War, majority being from the intelligence section or those who were involved in training of these mujaheddin. As on TV also, when u hear the ex-service guys speaking pro-taliban views, Gen Hameed Gul, Col Imam etc etc they are all from the era of the Soviet Afghan War, from where they got influenced.
So there is no fix theory on when they become extremists, but in service there is definitely a very very strict check on the activities of officers and soldiers in the field, personally i believe they become more of these extremists after they are gone out of service.