You simply apologize. Note that you do not apologize for your intentions of because they feelor for them feeling bad (like "I'm sorry you feel that way"). You apologize for the offence you caused (whether it was your intention or not). If appropriate, you may explain what your intentions were.
Example:
- You: "blah blah blah something that sounds [or is] sexist."
- Another person: "That is offensive"
- You: "I'm sorry I offended you. That was not my intention."
- Another person : "Ok. blah blah"
- (optional) You: "The comment meant blah blah blah. Thank you for bringing up that it offends people. [or something similar]"