Ma'am is used as a title of respect, especially when addressing female royalty
Word Origin and History for ma'am
also maam, 1660s, colloquial shortening of madam (q.v.). Formerly the ordinary respectful form of address to a married woman; later restricted to the queen and royal princesses or used by servants to their mistresses.