I heard that weight training will lower a person's flexibility over time. How to preserve the flexibility while getting stronger? Is the answer taking up yoga classes at the same time? Or, is there an option without this?
There are many kinds of weight training. A well-designed program designed to develop strength, power, conditioning, and athleticism for sport will not make you less flexible. The movements themselves in such a program will make you more flexible and even force you to improve mobility in order to complete the program.
Hallmarks of such an approach are full range of motion exercises like deep squats, exercises that require proper posture like deadlifts, and a balance between pushing and pulling.
To (over)generalize, bodybuilding-style training often neglects these factors and hinders mobility, whereas Olympic-weightlifting style training by necessity produces fairly flexible shoulders, hips, and hamstrings.
I heard that weight training will lower a person's flexibility over time
This is one of the many weight training myths that seem to pop up every now and then.
Myth #7: Weight Lifting Decreases Flexibility. One of the realizations people who get into weight lifting have is how inflexible they are. Years of sedentary lifestyle may have tighten your hips, preventing you to Squat correctly. Weight lifting will make you regain your flexibility and maintain it. Especially the Squat will give your hip muscles a full stretch. But increasing your muscle mass or strength won’t reduce your flexibility at all. Read more: http://stronglifts.com/weight-lifting-myths-debunked/
If you’ve ever seen a bodybuilder (amateur or professional), you’ll notice the ease and grace at which they can pose their bodies. Often holding each pose for several minutes. Couple that with the increase in muscular mass without any loss of range of motion. Given the amount of weight they lift, I would consider that flexible.
First, do the exercises in their full length, i.e. no 10 inch squats, no half-assed bench presses where you don't even touch your chest, no lat pulldowns where you yank the weight with your whole body to only reaching your chin.
Second, flexibility training, this does not mean that you should spend a few minutes doing some improvised stretching movements, it needs to be taken seriously. Personally I'm fine with being an inflexible muscle beast so someone else will have to inform you here, if you don't google it :)
This is actually not true. Flexibility is lowered by not reaching end ranges of motion. Weight training, if performed to end ranges of motion, increases flexibility. It's essentially many repetitions of dynamic stretches. Being weighted actually forces an increase to end range of motion. On the other hand, if you weight train without reaching full extension, and just perform "half reps" the entire time, yes, you aren't doing yourself any good.
That said, I think your concern is related to kyphosis. You've heard that working out the "front" muscles, such as chest and abs will worsen the problem. This is true, and especially common with guys who just do chest work. However, the inflexibility is not due to the weightlifting per se, rather the imbalance of musculature that develops.
Most muscles are structured such that another muscle can perform the exact opposite movement. These are called antagonist and protagonist muscle groups. If a protagonist muscle is overdeveloped, its antagonist won't adequately balance the load on the skeletal system. In the (most common) case of the chest and back, if the rhomboid muscles are underdeveloped, and the chest is overdeveloped, scapular protraction is favored and kyphosis can eventually develop.
To add a caveat here, that's not to say this is what's happening in your case. Kyphosis can develop from other issues such as postural deficiencies, which tend to be much more systemic than single antagonist/protagonist imbalances. I still recommend the front squat for this reason, which will also be incorporating a ton of rhomboid work when performed.
So, to answer what I think your question is, yes, you should be cognizant of developing muscle imbalances. This could slow your progress with fixing your kyphosis. Everyone loves chest day, yet people are quick to put their back day on the back burner (harder to see a back pump in the mirror, right?). So if you have a chest day, have a back day too (or if you do an upper/lower split, hit them both). And don't just do pull-ups, get some rows in there too (more about that here).