The prevalence of sexual conflict in nature, along with the potentially stochastic nature of the resulting coevolutionary trajectories, makes it an important driver of phenotypic divergence and speciation that can operate even in the absence of environmental differences. The majority of empirical work investigating sexual conflict's role in population divergence/speciation has therefore been done in uniform environments and any role of ecology has largely been ignored. However, theory suggests that natural selection can constrain phenotypes influenced by sexual conflict. We use replicate populations of Drosophila melanogaster adapted to alternative environments to test how ecology influences the evolution of male effects on female longevity. The extent to which males reduce female longevity, as well as female resistance to such harm, both evolved in association with adaptation to the different environments. Our results demonstrate that ecology plays a central role in shaping patterns of population divergence in traits under sexual conflict.