After defeating Kahuna Hapu and completing your Island Challenge in Pokemon Ultra Moon, you will be able to find Solgaleo with Lillie on Mahalo Trail back on Melemele Island. Not being able to properly take care of Lunala like a Pokemon Trainer would, Lillie asks that you battle and capture Lunala so it can continue to travel with you.
Like many other Legendary Pokemon, Lunala makes for a very difficult capture. To start, odds are it will be equal or higher than most of the Pokemon on your team, sitting at a pretty decent Level 60. It will also probably be faster than most of your Pokemon, with a Base Stat of 97 (one of the higher speed stats for Pokemon found in The Alola Region). And let's not forget the offensive and defensive power it has, plus its exclusive ability that basically works like Multiscale, cutting the damage it takes at Full HP in half. Yeah, this thing won't be easy unless you're using a Masterball on it, which isn't at all necessary.
As like most Legendary Pokemon that don't have the highest of levels, you should definitely only be using Ultra Balls on Lunala, but only after getting its HP as low as you possible can. This can be incredibly difficult to do, since it won't have any problem crushing all sorts of holes in your team as you do. And that's why you need to have more than the average amount of Ultra Balls, Revives and Max Potions on hand when facing it.
False Swipe is also a nice move to have on one of your Pokemon, guaranteeing that Lunala will be left with at least one HP, should you have the TM or a Pokemon that knows it. Thunder Wave also works best as status conditioning to make Lunala easier to catch, since it's permanent (unlike sleep) and it doesn't cause Lunala to lose any HP. If you have the Rotom Power that makes it easier to catch a Wild Pokemon, then you should definitely consider using it here as well. And don't forget to ALWAYS save before facing Lunala. It's a safety precaution, one that has worked since the first generation of Pokemon.