This is a tricky question. The answer depends on what caused balanitis.
If balanitis is due to normal bacterial infection or due to the usage of any chemical (used in soap etc), this is considered non-contagious.
If balanitis is caused by an STI, yes, the STI and the microbes present in the foreskin are transmitted to the other person. Here only the microbes are transmitted but not the disease.
Certain bacteria, fungi or viruses cause balanitis and that is contagious.