My 14 yr old son is going to start taking 500 mg of cephalexin twice a day for acne. Is it safe to take this for a long period of time?

It is safe. This regimen is safe if properly managed by the prescribing doctor. Your dermatologist selected this particular antibiotic for a clinical reason, & his/her recommendations should be followed. Cephalexin is often used for pustular acne that tests positive for staph or for acne that has been resistant to the typical antibiotic, tetracycline, which can be contraindicated in an immature 14 year old.
Antibiotics are not. suggested to be used for long periods of time as they can lead to antibiotic resistance. Also there are better oral antibiotics available for acne, Keflex is one of my least favorite choices. I prefer once a day dosing for teenagers as it is much easier to remember. Ask your dermatologist and make sure you son is also on topicals agents as well.