Could using sunscreen for lubricant be causing me to get prostatitis?

Certainly possible. The preservatives, additives and fragrances are not intended to be applied to the urethra and this could theoretically lead to a risk of prostatitis but is highly unusual.