I have been around quite a few foals and each one I have gotten to know is unique. However, there are ways, in general, foals behave and react.
There are so many ways to get a horse used to being handled or touched. "When is the best time to handle a foal" varies a bit from person to person. Some start on day one others wait until they are weaned, a yearling or 2 years old to work with them.
I don't think there really is a right or wrong way or time to get a horse used to humans and the world as long as the foal's well-being and safety are the priority. Riding is another topic and it is best to wait till they are mature to be ridden.
How you get a foal used to being touched/handled really depends on the dam and the foal.
I am pretty hands-on and start getting a foal use to me the day they were born if the mare is comfortable with me doing so. If they are not that is ok and very normal for a mother horse to be protective of her new one and that should be respected because if not someone could get hurt. It would also stress out the mother which the foal would pick up and be stressed out as well, which is not something you want as a first impression.
It is a good idea to start early to prepare them for things like a vet check or even an emergency. If you need to help them out, if they are familiar and comfortable with you it is a lot easier, safer, and less stressful when treating/ working with them. Personally, I like to start introducing concepts before they are weaned so when they are weaned it is less stressful and they are already familiar with me. I find it less stressful for the foal and myself but again, personal preference. It is possible to overwhelm a foal, they do have instincts to not want to be touched. They may, most likely, will kick if you do too much too soon. Don't take it personally, this is the foal's natural instinct to protect itself. If a foal is not interested you can just hang out in the stall or brush the mother. If your mare is totally comfortable and you are comfortable with her. Kneeling is another tactic. It makes you less intimidating if you are at the same level as the foal. This usually piques a foal's curiosity and encourages the foal to come up to check you out. When they do, contain your excitement and just let the foal explore you on their terms. Bit by bit the foal will become familiar with you. You can have the foal check out your hand and try touching the foal. The withers or neck seems to be the most common place to start It may or may not back off. Either reaction is fine. You don't want to correct or reprimand at this age because they are just learning. They have no clue or context of what is going on. Keep in mind to keep it fun and light-hearted for them and you!
If you can find a nice itchy spot, usually withers, neck, or chest, you may just win them over with that. They may even try to scratch you back and it's pretty harmless when they have no teeth. Eventually, they will have teeth and horse scratches are not as gentle as human scratches. People have different opinions on how to handle it. Having a horse lick or scratch you can encourage or turn into nipping and being mouthy. It is pretty normal for foals to be mouthy as that is how they explore. I usually don't mind them licking me or being mouthy as long as it is on my terms. If I want them to stop I usually push them away, may take a few times to get the message across. If they are older/more persistent I will be much more clear with my message by being more direct with pressure and verbal (saying "no" or hissing) and usually, over time the horse can figure out humans don't like to be nipped or chewed on but licking is fine. Again this is all personal preference, if you don't like licking then let that be known.
Once you get them used to being touched all over you can also brush them and try picking up their feet ( though I would not focus on this too much right now) along with the concept of yielding to pressure. I like to start with the horse yeilding their back quarters and move on to the front. I also squeeze/hug them, note this can trigger an instinctual response at first so take it slow. All of this will get them really comfortable with you and ready for a halter. I am always trying to learn something new. Actually, I always end up learning something new.
I have a few videos I found on youtube that are a really good starting point and explain things. Also giving the variety of approaches, timing, and amount of work. They are pretty much the first ones you see when you type in "handling a foal":
Foal Handling Tips In The First Few Days by Basic Horse Training
Training A Foal Using Basic Principles by Basic Horse Training
A very similar approach to mine and it had been a good 10 years since I had worked with a foal so this was a great refresher!
Our foal handling process 101 sponsored by Weaver Leather by WarwickSchiller
More hands-off foal-driven approach and Warwick explains why. This is what worked best with my Frisky with the personality she had.
Foal Training: Desensitizing Through Touch and Rub by Clinton Anderson
Little controversial hence comments are turned off. This is more on flooding the foal's senses to where it doesn't bother them (desensitization). A lot of people see this as overwhelming and unnecessary ( laying the horse down and rubbing them all over while being restrained). I see it as a sort of a shortcut to getting results fast. It is effective, it's like sacking out but all in one day. I don't prefer this myself as I find it is a lot all at once but foals are resilient and in an emergency or for whatever reason it may be necessary.
Foal Handling with Monty Roberts by Monty Roberts
Something new I learned this year! When working with Carbon it was a bit different than my other foals. My foals in the past were tiny! I could easily grab them and even pick them up if I had to. Also, we had a lot of land and relatives nearby. My foals could interact freely with other horses who I knew. Carbon who is sooo much bigger than what I am used to. The other horses around are not my own and we are also near a road with a good amount of fast traffic. I needed a bit of a safety net and the figure 8 rope helped me out a lot!
Below are some short clips of moments I was able to capture of what it was like when he was just getting used to us: