We consider the problem of optimally maintaining an offshore wind farm in which major components progressively degrade over time due to normal usage and exposure to a randomly varying environment. The turbines exhibit both economic and stochastic dependence due to shared maintenance setup costs and their common environment. Our aim is to identify optimal replacement policies that minimize the expected total discounted setup, replacement, and lost power production costs over an infinite horizon. The problem is formulated using a Markov decision process (MDP) model from which we establish monotonicity of the cost function jointly in the degradation level and environment state and characterize the structure of the optimal replacement policy. For the special case of a two-turbine farm, we prove that the replacement threshold of one turbine depends not only on its own state of degradation but also on the state of degradation of the other turbine in the farm. This result yields a complete characterization of the replacement policy of both turbines by a monotone curve. The policies characterized herein can be used to optimally prescribe timely replacements of major components and suggest when it is most beneficial to share costly maintenance resources.