An attacker passes the ball backwards but it hits a defender and deflects forward to another attacker coming from an an offside position. The attacker gains control, turns and shoots toward goal.
Is the play to be disallowed for an offside pass?
Offside. All what matters is the relative position of ball and receiver (forward) at the time of the pass. The rules do not specify anything about the direction of the pass.
From Law 11 of the FIFA Rules:
Offside position A player is in an offside position if- he is nearer to his opponents’ goal line than both the ball and the second-last opponent. A player is not in an offside position if he is in his own half of the field of play OR he is level with the second-last opponent OR he is level with the last two opponents
If it is a deliberate pass by the defender however, the forward is not offside.
An offside position cannot occur when the ball comes from the defense, the most famous goal that illustrates that is the "The hand of god", the goal was controversial because of a hand play even though Maradona was seemingly offside, the reason he wasn't, is because the ball came from Steve Hodge.