It is the female equivalent of "sir". Children usually call their teacher "ma'am"; employees often call their boss "ma'am".
HOWEVER, be careful. In very generalized, stereotyped terms:
Boys are usually very proud the first time they are called "sir". It means they have earned your respect.
Young women are often shocked the first time they are called "ma'am". It means that they are no longer young and beautiful, and people are now thinking of them as a mother or as a professional instead of as a potential marriage partner.
Of course, in the right context a girl might be happy if you call her ma'am, and in the wrong context a boy might not be happy if you call him "sir", but in general "ma'am" is a more dangerous word than "sir". Use it with caution.
Lastly, the word is very common as a respectful address for all middle-aged and older women in the American South and Midwest, but it is much less common in the Northeast and on the West Coast. There, only use "sir" and "maám" if you are talking to your professor or your boss.