Yes the condition gangrene can be contagious in some ways such as through poor infection control practices including ways such as bacteria being passed from patient to patient via contaminated surgical instruments or gloves.
But just being around someone who has gangrene doesn't mean that you'll catch the gangrene from someone who has it.
I would however avoid touching the person who has gangrene to prevent you from getting it in your skin through contact in case you touch an infected area on the persons body.
My Grandpa has gangrene of his leg before and was in the hospital and I visited him in the hospital and the doctors said it was okay to be around him.