The adaptation of photosynthesis to extreme environments, such as deep sea hydrothermal vents or high altitude environments.