To practice hitting out of trouble, practice hitting crosscourt with a ball machine or a partner.
The key to hitting your way out of trouble is hit the ball crosscourt. When you hit crosscourt, you buy yourself time to get back into position.
But DON’T just stand in the alley and wait for the ball. You have to practice putting yourself in danger, to practice getting out of it. This means returning to the middle of the court after each hit and focusing on your footwork to get back to the ball in a way that you can return it again crosscourt.
Focus on hitting crosscourt and moving your feet.