Disclaimer: I am not a doctor. This non-medical advice is based on my research (which I have not provided for your reference) and experience as a lifter and strength coach. It is not medical advice or prescription, and anyone with or without injuries considering engaging in an exercise program should consult their doctor prior.
Maybe you get into the gym and your back hurts a little. It's not horrible, but it's a little tight and has a sharp pain if you move in just the wrong way. You consider not lifting, but you do anyway. Your pain decreases as the workout continues and is almost gone at the end of the workout.
Another time, your shoulder has a burning sensation and hurts when you put it over your head. So you go into the gym anyway, and as the sets continue, the pain gets worse and worse. You try to finish your workout, but the pain is intense and getting worse, so you stop and go home feeling worse off than when you came in. You wish you hadn't even gone in at all.
Everyone has had the previous experiences.
Knowing when to train and when not to train is extremely difficult before the actual training. There are a few ways of determining if you can train through the pain.
Perhaps you don't train, but you have consistent chronic pain in your back or knees. It's not from a particular injury. You just have knees and a back that are beat up, and you haven't exercised in a while.
What to know if you're considering starting a strength training program
Many people with chronic or acute pain will choose to forego starting a training program. The thinking being that the pain needs to go away. This is correct sometimes. There are pains in need of repair that cannot be fixed in the weight room and can be exacerbated by use. However, most people with chronic joint pain (especially low back and knee pain) can benefit from starting a strength training program if a prior condition is not contraindicated.
I see this many times with new clients - they come in with back or knee pain. I teach them how to squat, press, and deadlift, and we make the weight on the bar go up. We make them stronger. The pain is frequently reduced or gone entirely in two or three weeks.
So why does strength training reduce joint pain in some cases and not others? The answer is in the name: strength. Someone with weak muscles will typically have unbalanced joints. This can lead to joint pain. Pain caused by this can be reduced by making the muscles stronger and the joints balanced. The way to do this is to perform exercises that force symmetry and balance about the joint.
Pain that is not caused by muscle weakness will not be reduced by making the muscle stronger. An obvious example is a broken bone. There is no series of exercises that will fix a broken bone as a result of making the muscle stronger. Flooding the area with blood can be beneficial, but this is not the same as making the muscle stronger. This does not help in structures like cartilage where blood cannot access.
The barbell squat, press, deadlift, and bench press are extremely effective at making joints stronger and balanced. The barbell is free to move in all directions which means the muscles must control the bar so it is centered and level as it moves up and down. The unbalanced joints have the weak muscles get stronger and the strong muscles stay where they until the weak muscles catch up. The muscles have no choice but to gain strength in a balanced way, and soon after starting, the joints are balanced.
What to consider if you're in the middle of a training program
Someday, you're going to feel a pain in your back or knee or shoulder and you're going to think about not lifting that day. Sometimes, this is the right call. Most of the time, during warm-up is the time to make that decision - not before the workout. The general rule is that the injury needs to be left alone if the pain gets worse as the warm-ups progress. If the pain stays the same or gets better, finishing the workout may actually be beneficial to the injury.
Both acute and chronic injuries can generally be worked around either by modifying the movement or substituting it for a similar exercise that doesn't exacerbate the problem.
You're going to get hurt. It's going to happen. It might happen while lifting weights. It's more likely to happen while you're moving furniture or slipping on ice. But it's going to happen. When do you get hurt, you have to choose if it's time to lift normally, lift with modifications, or not lift at all.
Possibly useful modifications to keep training
Some injuries will be exacerbated by specific positions, and in this case, the programmed exercise can be changed to accommodate this injury. Shoulder and elbow injuries can be irritated by the low bar position in the back squat. Switching to a thumbs-around grip or a high bar back squat will make the lift less efficient. However, this may provide the relief that allows the trainee to get through a month or two of workouts while the shoulder or elbow is healing.
Some injuries make performing certain exercises impossible. Doing a different exercise that incorporates similar muscles and load is a good option if omitting the original exercise is necessary. A good example of this is the bench press and weighted dip. The weighted dip can be loaded heavy and stress many of the muscles used in the bench press. If someone cannot bench press without pain but can do weighted dips, this can be an excellent way to mitigate muscle loss while the injured component heals.
Just because you have pain doesn't mean you can't start or continue strength training. Training can be beneficial in healing the injured body part and many times getting stronger will make some chronic pains go away. Modifying the exercise or changing the exercise can be an effective way to continue training without exacerbating the injury. At a certain point, you may need to see a doctor to diagnose and treat the injury. Most injuries do not require professional intervention, but many injuries do not just go away and must be medically treated.