The oil temperature sensor is an electronic device in your engine, that monitors the temperature of your motor oil. Most sensors in your engine don't have a recommended service interval, you just have to replace them when they fail. So, if your engine starts overheating without warning, chances are your oil temperature sensor is not working properly.
Replacing the sensor is an inexpensive maintenance compared to the damage that can be done. If an oil temperature sensor is not working properly, the engine won’t know when to shut itself off and will overheat. Ignoring an overheating engine can lead to permanent damage.
From a safety standpoint, an overheating engine could leave you stranded. However, from an environmental point of view, there is no impact from oil temperature sensor replacement.