My house is being 'treated' for termites. Will this affect my two year old?

It depends on both the type of termite and the type of treatment. Basically there are three types of treatment.

The lowest risk are with baits for subterranean termites which use hormone-like chemicals to interrupt insect growth. These are very low risk to people (and anything else with its skeleton on th inside).

Next are the fumigant gases uses when a building is tented for drywood termites, these evaporate away almost entirely and pose little if any risk to you (or returning termites).

Llast are the straight poisons which are usually applied to the soil but are incresingly used indoors as well. These always pose some risk, especially if poorly applied. You need to find out the identity of the toxin and look it up on the next. Search on 'toxicity of" and then the chemical name. Some are much worse than others an all persist for quite some time. The biggest risk is chemicals sprayed on the soil around the building where your child plays and will inevitably pick up and ingest some (kids eat a lot of soil).