I had this same problem, and all I had to do was replace a fuse and everything worked all right. However you may, in this case, have some faulty wiring.
If your turn signal stops working when your headlights are on, there is something wrong with your car. This should not be occurring, and is a major safety hazard. You should have your car checked out immediately.