Thank you for writing!
Balanitis is mostly caused by Candida - a yeast infection/thrush. But it can also be caused by bacterial infections or can be due to previous sexually transmitted infections. The male should be checked for STIs and other infections to rule that out.
But balanitis itself is not contagious. If the male does not have any other infections, you will not get balanitis from having sex with him.