Our sense of smell develops in the womb. In fact, as early as 6-7 weeks into pregnancy, olfactory neurons, which help to process odors in the brain, start to develop. Just a few weeks later the baby has nasal cavities, creating the foundation of the nose. Soon after, the connection between what the baby inhales through the nostrils and what she tastes in her mouth is made.
Around weeks 7-10, the baby is able to react to touch and warmth as well as chemical stimuli like the freshness of mint or the spiciness of pepper. The olfactory smell receptors start to form in the third month. These receptors are what will later identify odors in the outside world.
In months 4 and 5 the olfactory receptors are connected with the olfactory bulb in the brain. This connection is what creates the smell gateway from the outside world to the brain. By the 6th month the baby is ready to detect odors.
Although, understandably, no research has been done on babies in the womb, there is some research on preterm infants that suggests babies are able to smell throughout the third trimester, and maybe even earlier.