This is how the sex ratio got to 50% in the first place, evolutionarily. If there's an excess of women, men will find it relatively easier to find a mate, and so women whose genes cause them to bear an excess of sons will pass more of those genes down into the third generation. If there's an excess of men, men will find it relatively hard to find a mate, and so women whose genes cause them to bear an excess of daughters will pass more genes onto the third generation. It balances out at a 50/50 steady-state.
Curiously, the sex ratio can get skewed by environmental conditions, in a manner similar to what you describe. Men have more reproductive variability than women - the number of children a woman can bear is largely limited by her uterus, while the number of children a man can bear is limited by the number of women he can convince to sleep with him. So when times are good, or if a mother is high-status within her particular group, she tends to bear more sons to take advantage of their reproductive success. While when times are lean, mothers tend to bear more daughters.
A similar effect occurs on the level of individual traits. Couple who carry genes that disproportionately affect the reproductive success of one sex tend to have more children of that sex. For example, someone did a study of Hollywood actors, and found out that 60% of their children are daughters - presumably because Hollywood actors are better-looking than average, and beauty benefits girls more than boys. Taller and more muscular parents tend to have more sons, etc.
And what's the mechanism for this, since everyone knows sex is carried on the male's Y-chromosome, and women shouldn't be able to influence it? Sex-selective abortion. Apparently, females of most mammalian species will absorb the blastocyst into the womb (or otherwise abort very-early-stage fetuses) if environmental conditions aren't right for a child of that sex. So China and India are just using technology to do what biology has done for tens of millions of years.