Molluscum is a very contagious skin condition that you can get anywhere - you can get it from touching other people, but you can get it from surfaces like towels, sporting equipment, things at the gym, children share it at day care centers, etc.
People with weakened immune systems might be more likely to get it, but anyone can get it. It can be transmitted sexually, but that's not the only way it's transmitted.
https://www.healthline.com/health/molluscum-contagiosum