The answer depends a little on what exactly you mean by "recognize their shadow is their shadow".
The simpler understanding of shadows
If you mean "realize that their shadow matches their own movements" (i.e. that they can control their shadow), then all that's required is for them to 1) see their shadow, and 2) notice the contingency between their own movements and the shadow's.
Seeing their shadow: Young infants have pretty bad vision at any distance farther than a couple feet away, so the age at which they'll be able to see their shadow clearly enough to notice its movements depends on how high contrast the shadow is, how far away it is, and how old the infant is. Newborns would only be able to see shadows that were quite high contrast and almost right in front of their faces, but older infants and children would be able to see shadows farther away and with lower contrast.
Noticing the contingency between their own movements and the shadow's: Infants are actually very good at noticing contingencies, and they are generally delighted by them --- anyone who has given a toy that lights up and makes sound to a baby will likely remember (with a grimace) the constant, repetitive activation of the toy as the baby pushes the button to "make it go" over and over. Babies are surrounded by contingencies, and noticing them is a big part of learning about the world. Here are some examples, all of which you may recognize as favorite games of many babies:
- drop things and they fall
- bang things and they make a sound
- smile at adults to make them smile back at you
Infants are great at noticing contingencies very early on, and they especially like things they can control. Most of the scientific research on infant memory and cognition relies on this fascination for contingencies, in fact.
A classic example is the mobile task developed by Prof. Rovee-Collier. The baby lies down in a crib underneath a hanging mobile, and the researcher ties a ribbon from the baby's ankle to the mobile support. When the baby kicks his/her leg, the mobile will jerk around. Infants as young as 2 months realize this quickly and will kick their legs more than usual in order to activate the mobile. Rovee-Collier and her colleagues designed several clever experiments to test infants memory development using this task. Even earlier in development, scientists can use contingencies between the rate newborns suck on a pacifier and the appearance of other stimuli to test newborn cognition. For example, in a classic study Prof. Morse gave newborns a special pacifier that measured how fast they sucked and would trigger an audio system to play simple speech sounds or other noise depending on whether they sucked faster or slower. Newborns (40–54 days old) picked up on the fact that could control what they heard by sucking faster or slower.
So basically, it appears that babies are sensitive to (and interested in) things they can control in their environment pretty much from birth. In that case, the age at which a baby might recognize his/her shadow and understand he/she can control it would be as soon as he/she gets a good enough visual experience with one. Infant visual development and the availability of a clear, high-contrast shadow is probably the limiting factor in many cases, rather than an infant's ability to notice the relationship between their own movements and the shadow's.
The more complex understanding of shadows
If by "recognize their shadow is their shadow", you mean something more like "understand that his/her shadow is a representation of his/herself", then that's a bit more advanced.
Not only does that require seeing the shadow and noticing its movements are contingent, it requires having a sense of "self" in order to recognize that your shadow is an image of you. The sense of self develops slowly over the first several years of life.
A good analogous test is the rouge test used to tell whether babies recognize themselves in the mirror. Typically developing infants don't pass this test until around 2 years. Note that infants much younger than that will notice the baby in the mirror and often be delighted by the fact that Mirror Baby moves when he/she moves --- this is analogous to the simpler definition of shadow understanding discussed above --- but he/she won't realize the fact that the mirror baby is him/herself.
Because passing the rouge test is thought to reflect (no pun intended) a developing sense of "self" rather than anything specific to mirror reflections per se, one would expect an child to be able to recognize that his/her shadow is a projection of his/her body around the same time. It would be a little harder to test than mirror reflections, but you could perhaps put something behind your child's head (not touching it) in such a way that the shadow made it look like he/she was wearing a hat, and see if he/she reached up to check his/her own head for the hat.
If all you're noting is that your baby moves his/her own body in an apparent attempt to move his/her shadow, then that doesn't necessarily mean he or she understands what shadows are in a deeper sense.