Look at yourself in the mirror, from the side. Focus on the waist band of your underpants. Drive your feet outward, and twist your feet into the ground. Then use your hips/glutes to “push” your pelvis forward, and get a neutral spine, and a straighter back. Tighten your Abs, and pull your ribs towards your pelvis. When your waist-band is completely horizontal to the floor, you are in the right position.
For practice, wear your lifting belt loose, low on your hips. Loop a resistance band over the belt, then step through the ends. Then, walk around, side to side and back and forth, while the band challenges your posture.
Then recreate that position in the gym. It could be Sumo deadlifts, or Romanian deadlifts, or Glute bridges or hip thrusts. Abs on a stability ball with a band around your knees. Maybe dragging a sled, tied to your belt, with a power-walking, Glute driven style. Whatever it takes.
For the top half, you have to get that upper back going. You need to get your shoulders “back,” or “deep” in the sockets. Your rear delts and traps do this. You could try face pulls, or shrugs face down on a bench, or dumbbell rows on an angle, or Cuban presses. Again, whatever you can feel working the “backs of your shoulders.” Then do pushups, and focus on getting your shoulders “deep” while you get your spine “neutral.” Keep tight. Like a plank. Then work to take this tightness and positioning into your benching and other upper body moves.
In your training, avoid moves that round your back over! Do not allow yourself to Good Morning your squats. Keep your shoulders back, your chest up, and drive with your legs. Don’t do chinups, or Pulldowns where you round over or hunch over at the top/bottom. If your back rounds on deadlifts, try snatch grip or shrugs to train your upper back to pull so you don’t round.
Between workouts, lay on the floor in the 90/90 position. Push your hips in and use your hamstrings so your lower back relaxes, and tighten your Abs so your spine gets neutral. Then do scap wall slides, on the floor, in this position. Practice good posture!
You can fix this, but you are literally over coming a life time of bad posture. You have to be on it all day, every day.