This paper investigates the effect of prenatal sex selection on fertility through a stochastic dynamic model with uncertainty in conception as well as in gender, where a woman makes decisions on conception and abortion with or without gender detection tests (i.e. sex-selective or sex-unselective abortion). The paper shows that, when the cost of gender detection test falls, the sex ratio at birth rises due to more selective abortions, but fertility can rise or fall with rising sex ratio. Fertility may rise (fall) if there are more (less) women giving up unselective abortions for selective abortions than women giving up childbirths without test for selective abortions. Similarly the paper shows that the sex ratio can rise or fall, when fertility decreases as the cost of children increases. I test these propositions as well as their implications against micro survey data on the pregnancy history of Korean women.