As an onomatopoeia, usually reduplicated as 咩咩. In Cantonese, 咩 is a very common question particle equivalent to Mandarin 什么 or 吗, but this usage is not standard Mandarin.
Mouth on the left is the standard onomatopoeia marker - it tells readers that the syllable on the right is a sound produced from a mouth. It joins 咩 with 喵 (cat), 汪 (dog) and 哞 (cow) in the animal-cry family.
Plays a double role: it supplies the sound (drifting from yáng to miē) and pictures the very animal making the noise. A sheep next to a mouth is exactly what 咩 transcribes - the cute, drawn-out baa of a lamb.