Apparently you have to have beaten the E4 and have Solgaleo/Lunala in your party
Go to the Altar of Sunne/Moone in Poni island and enter the distortion that's opened in the temple and head to the Lake of Sunne/Moone
Apparently you can only go through the rift at daytime in Moon and at nighttime in Sun