OT but yes, absolutely they’re related. There are a whole bunch of words in Arabic that are all related, from the root h-r-m, relating to the idea of a sanctuary, something that needs protection, or in the case of ‘haram’, something we should be protected from:
haram: bad, off limits, forbidden
haram (as in haram ash-sharif): sanctuary
Harem: sanctuary of the home, off limits to public/visitors
hurma: woman
mahram: one with whom you’re entrusted–a close male relative who is off limits to marry
Also in some arabic dialects they use the word ‘******’ to mean a thief, someone who is committing haram. I know this has a worse meaning in Urdu but in the Arabic I’m familiar with it was always used to mean ‘thief.’
there’s more too but that’s what I can come up with off the top of my head…