According to the abstract of this study of 60 3-year-old children:
From these experiments we conclude that children have the metalinguistic skills necessary to identify homonym pairs; moreover, they realized that homonyms represent two different categories. Finally, if children have a one-to-one mapping assumption, it is not strong enough to prevent them from acquiring homonyms.
However, this study involving adults and children found that younger children (grades 5 and below), will make fewer context-based interpretations of homonyms than adults.
The results suggest that homonymity is a powerful inhibitor of children's tendency to derive a meaning for a new word from context.
In plain terms, that means when a new word which sounds exactly the same as an old word (is a homonym), children have difficulty ascertaining the meaning of the new word from context.
The author of this last study, Michèle M. M. Mazzocco, has also done other studies regarding homonyms that may be of interest.
While this question asks about toddlers, research involving homonyms and homophones often includes older children. This study specifically studied 9-, 10-, and 12-year-olds and found differences.
Another study found that in children 3-6 years old, the ability to understand the homonyms grew with age, with a jump in ability around 4 years old.
This appears to be a subject that has ongoing research being done, with no clear, conclusive age about when homonyms are best understood. I would arrive at the interpretation that homonym acquisition is an ongoing process, rather than one that "turns on" at any given age, and that process can be helped along by reinforcement from parents and educators by using the homonyms in clearly different contexts. To use an example from one of the linked studies:
"The people are dancing at the ball."
"The players are hitting the ball with a bat."
Provide two clearly separate contexts for the homophones. Whereas
"They threw a ball."
Is potentially unclear, as it could refer to either of the homonyms.