For Sweden all males between the ages of 20 and 47 military service was compulsory.
A male who did not want to serve his conscription had several options. If he was weak due to tubercolosis in his childhood, deformed (had a limp) or similar reuction in his capacity, he could be placed in category O (for oduglig, useless). However, category O soldiers could be called up to have their health re-checked and if found able to do any service, he would be conscripted. This happened a lot in 1939 and 1940 with men that had been classified as O in the preceding years.
From 1902, people who held a deeply religious devotion to pacifism could ask to be placed in non-armed service (usually cooks, clerks, mechanics, depot staff etc).
If a man was not category O and refused bot non-armed and armed service would be arrested and tried. The punishment could range from fines to up to a year with forced labour in prison. However - after serving his sentence, he could very well be called up again, refuse again and be sentenced to another stint in prison.
There wasn't a lot of punishment in the UK because practically every man wanted to fight. As such Conscientious objectors could easily be placed into important civilian roles such as mining or working the docks.
In fact, the Brits were so short of men wanting to stay home they had to send conscripts down the mines (Bevin Boys)!
In reaity, the main punishment was that if you were a conscientious objector, you got ostracised by society. This was difficult for the Bevin Boys - as they were on the streets in civ clothes and of drafting age, people assumed they were conscientious objectors and spat at them in the streets, not knowing they actually signed up to fight yet were sent down the mines anyway!