This is a stupid question but what would exactly happen lets sy if you are driving down the highway and decide to change it from D to R or P???

My driving school taught us that if ALL of your brakes fail and have to stop quick that that would be our last resort in an emergency stop. Would the transmission be in pieces or what?