both. they supposed to enroll to army but in case they study in yeshiva they typically avoid it, till they reach the age when army "looses" interest in you.
it's one of the major pain points in israeli politics/society. army supposed to be people army but big chunk of population avoids it and all the time tries to pushes through knesset laws to make this avoidance permanent and supreme court strikes it down (because it violates equality clause)
one of the reasons for the very messy supreme court reform in israel that been ongoing for past half an year is to allow to make law that will give permanent exception from army to orthodox . they even wanted to make recently law that equates tora study to army service