RSTP bridge are compatible with normal STP bridges and it can work with the 802.1D bridge. But the problem is that the benefits of the RSTP will be lost if it works in 802.1D mode.
While working with 802.1D bridge a RSTP bridge will define two parameters.
1) A variable and
2) A timer
The value of the variable will decide which protocol will run on the RSTP port and the timer called a migration delay timer will define the duration of that protocol. The value of the migration delay timer is 3 seconds.
If the RSTP port receives a RSTP BPDU, then the port will run in RSTP mode and if it receives an 802.1D(STP) BPDU then it will run in STP mode. Whenever a BPDU is received the migration delay timer starts and the mode of the port is locked for 3 seconds.
If the RSTP port receives a RSTP BPDU, then the port will run in RSTP mode and if it receives a 802.1D(STP) BPDU then it will run in STP mode. Whenever a BPDU is received the migration delay timer starts and the mode of the port is locked for 3 seconds.
From the above figure you can see that switch-1, Switch-2 and Switch-4 are running RSTP and Switch-3 is running STP. Whenever a Switch-3 receives the RSTP BPDU'S it ignores and drops them. So it starts sending STP BPDU on the segment. Assuming Switch-2 received the STP BPDU from Switch-3, it changes its mode to STP mode.
After changing its mode to STP Switch-2 sends the STP BPDU'S to Switch-3. Now Switch-3 understands the STP BPDU'S and accepts them and makes the Switch-2 as designated bridge.