Leaving newborn babies to fend for themselves in the wilderness was a practice known as "exposure." This horrific practice pops up in a lot of ancient myths. That's why, when Alcmene exposes baby Heracles for fear of the vengeful goddess, Hera, we're not really all that shocked.
Heracles is definitely not the only Greek hero to go through exposure. The most famous other example is probably Oedipus, whose mother abandons him after receiving a terrible prophecy that the baby will one day sleep with her and killing her husband. This ends up being a very bad decision on her part and actually makes the prophecy come true. (More on that story here.) Unlike Oedipus, Heracles ends up being raised by his real family when the goddess Athena scoops him out of the wilderness and returns him to his mother.