I am 39 weeks pregnant and is having bad toothache can this cause me to go into labor?

Not likely. Toothaches don't put a pregnant lady into labor. But...At39 weeks you might want to get that tooth taken care of because when that baby arrives...Your time is going to be limited for awhile. And who really wants to live with a newborn, sleep deprived and have a toothache.
No But... The toothache probably won't cause you to go into labor, but it can put a lot of stress on your baby. When you are in pain, your body releases a lot of stress hormones. These have a negative effect on your baby. Also, by the time a toothache is bad, there is frequently infection present (or will be soon), which is obviously not good for your baby. See a dentist asap to get this addressed.
It Depends. On how severe your pain is. Remember that if you are in pain, it may be effecting your baby also. Ask your ob/gyn. You are going into labor now to a maximum 3 weeks from now anyways. Your toothache can be taken care of by your dentist now. Why wait? Unless the pain is tolerable, take care of it, before you have your baby, and enjoy your baby after you deliver him/her, and don't worry about an ache.
Don't delay . You must see a dentist immediately. If you have a dental infection it is not healthy, especially if you are pregnant. Your dentist may just prescribe antibiotics until after your delivery. Sometimes emergency treatment is possible prior to delivery to relieve your pain.