We examine the action of natural selection in a periodically changing environment where two competing strains are specialists respectively for each environmental state. When the relative fitness of the strains is subject to a very general class of frequency-dependent selection, we show that coexistence rather than extinction is the likely outcome. This coexistence may be a stable periodic equilibrium, stable limit cycles of varying lengths, or be deterministically chaotic. Our model is applicable to the population dynamics commonly found in many types of viruses.