Nothing. Do absolutely nothing different than you would do if you were clothed. Normally, it goes like this... They see you and realize that you're not wearing anything. Until they know that you see them, their initial reaction is just one of curiosity. Why is that person naked? Should I leave before that person sees me and is distressed. Then you see them and behave in a distressed manner. They see your distress and either are distressed themselves for being in that situation, are distressed for you, or in some cases, delight in your distress and attempt to further it.
It works out much better for both of you if they see that you see them, and you make it obvious that you don't care. That leaves them with the curiosity and maybe some worry that you might be weird, but if you don't act weird, it puts them at ease. Continue doing what you were doing, showing that it doesn't bother you in the least that you're naked or that they are seeing you naked.
This works great when you're caught skinny-dipping or camping in a remote area which turned out to not be remote enough. If you're in an area where nudity is technically not illegal, you aren't doing anything wrong and you should behave as if you have a right to be there in the nude. If you're not supposed to be nude there, appear harmless and oblivious to your nudity, hoping for ignorance on their part, or at least some forgiveness. Besides, if you're out in a remote area, it's too much trouble for them to report you, and by then you could be long gone.
Smile, wave, and go about your business. You'll be surprised at how many people just smile, wave back, and continue on.