Lunala and Solgaleo are aliens, and may not have the same gender system the rest of the Pokemon world has.
Lunala, for instance, is said to "live in another world."
Said to live in another world, this Pokémon devours light, drawing the moonless dark veil of night over the brightness of day.
Solgaleo's Sun entry says the same.
It is said to live in another world. The intense light it radiates from the surface of its body can make the darkest of nights light up like midday.
All Box-art legendaries are genderless as well.
Also, Gamefreak Logic.