It can be a complication of thrush - and thrush can be a result of uncontrolled diabetes or a treatment for diabetes which causes glucose to be excreted in the urine.
If there is already considerable scaring then circumcision may be the only option, due to the narrowing effect - but there may well be other options and treatments - with some care and attention you might not need it.