Yes babies do actually know their mothers and after being born they can tell who their mother is by the sound of their voice.
In the mothers womb the baby hears the mothers voice and gets used to the voice of the mother so by the time the baby is born they can tell through the voice of their mother who she is.
Beginning in the mothers womb, a fetus' develops auditory pathways and is able to sense the sounds and vibrations of it's mother when it's born.
So when they hear unfamiliar voices they may cry because they don't know who they are yet but when the mother holds the baby and talks to the baby they usually love the mother and want to be held by the mother.