After defeating Necrozma and saving The Alola Region, you will learn that Necrozma has fallen through to another world. However, you will not be told what and where this location is. As you climb Mount Lanakila towards the Pokemon League, you will actually find Necrozma in crater, still being very weak from you having defeated it. As you interact with it, it will actually ask you if you would share some of the light from your Z-Ring with it. Should you accept, it will find just enough strength to battle you.
Necrozma will be in its first and original form when battling it here, being now at Level 65. It will be a pure Psychic type with the ability of Prism Armor, knowing the moves of Photon Geyser, Iron Defense, Power Gem, and Night Slash. After defeating or capturing it, you will find the Ultranecrozium Z, allowing you to ultimately transform Necrozma into Ultra Necrozma.