Torque from the power unit reaches the wheels not directly, but through a chain of components: clutch, gearbox, differential, and other elements. The transmission allows the engine to operate in a favorable RPM range at any speed, and the clutch is needed to disconnect the engine from the gearbox when the driver changes gears.
Here's what a standard layout looks like:

When reverse gear is engaged, the input shaft begins to rotate in the opposite direction.
Manual and automatic gearboxes have significantly different designs, so their reaction to an attempt to engage "reverse" while driving forward will be different.
Car with a manual gearbox
There are many variants of manual transmissions, but it's convenient to understand the principle using a three-shaft gearbox as an example:

Force from the engine (via the clutch) is transmitted to the countershaft, where a block of gears is rigidly mounted. From this shaft, torque goes to the differential and then to the wheels.
The gears on the splined shaft that goes to the differential are mounted on bearings and can rotate freely around it, each at its own speed.
Simply put, when the engine is running and the lever is in neutral, the shaft from the engine, the countershaft, and all the gears rotate. However, the splined shaft and the coupling remain stationary, and no torque is transmitted to the wheels.
The coupling is needed to rigidly connect one of the gears to the splined shaft (it can slide along the shaft) and thereby begin transmitting force:

Which gear to engage is decided by the driver when selecting a gear, and the coupling "hooks" that gear.
The layout of a five-speed manual with reverse looks like this:

When changing gears, a specific coupling engages, connecting one of its gears.
Reverse is implemented through an additional idler gear that causes the corresponding gear on the splined shaft to rotate in the opposite direction.
During shifting, the teeth of the coupling disengage from the grooves on the face of one gear, and then the coupling engages with another.
To disengage the coupling from the gear and then re-engage them, the torque flow from the engine is interrupted—the driver presses the clutch.
Recall: the gears on the splined shaft rotate at different speeds. To avoid loading transmission components during shifts and to make control more comfortable, synchronizers were invented—they equalize the rotation speeds of the coupling and the gear before they mesh.

What follows from this? Here's what: when shifting, the rotation speed of the coupling (which matches the speed of the output shaft) is adjusted by the synchronizers to match the gear's rotation speed. Furthermore, the reverse gear always rotates in the opposite direction to the other gears and the coupling, so the coupling teeth simply cannot engage with it.
These two factors prevent engaging reverse while moving—you'll hear a grinding noise, but the coupling won't engage, and even the gearshift lever physically won't move into the reverse position.
But there's a nuance: if you persistently try to engage reverse while moving, you can damage the synchronizer, coupling, or gear—they will experience increased loads, even if without result.
For completeness, let's add: yes, in the first half of the last century, passenger cars were often equipped with gearboxes without synchronizers. But the essence doesn't change—reverse still cannot be engaged while moving, but the risk of breaking the gearbox increases many times over.
Car with an "automatic"
In cars with an automatic gearbox, the clutch function is performed by a torque converter (its principle is that torque from the engine is transmitted to the transmission not through a rigid connection, but through a viscous fluid).
A key feature of an automatic transmission is that the same set of gears is used to obtain different gear ratios, whereas in a manual transmission, each gear has its own.
This is achieved through a planetary gear set, where gear ratios are changed by fixing certain components relative to others.

A planetary gear set is a system of several planet gears that rotate around a central sun gear:

Stationary | Input | Output | Gear |
Ring | Sun | Carrier | Reduction |
Carrier | Sun | Overdrive | |
Sun | Ring | Carrier | Reduction |
Carrier | Ring | Overdrive | |
Carrier | Sun | Ring | Reverse, reduction |
Ring | Sun | Reverse, overdrive |
Gear shifting (i.e., fixing the required element) is controlled by hydraulics or electronics.
In both cases, there is a speed sensor on the output shaft of the automatic transmission: in a hydraulic system, it creates pressure proportional to the vehicle speed, and in an electrical one, voltage.
Shift points are determined based on vehicle speed and engine load. Additionally, a range selector valve connected to the gearshift lever participates in gear selection, which, depending on its position, prohibits engaging certain gears.
In other words, in an automatic, gears are managed by the control unit, which receives data from the engine and the gearbox shaft. It will not engage reverse while moving forward, no matter what the driver does with the lever. At most, the gearbox will go into "neutral."
For added reliability, many modern cars are equipped with a mechanism that prevents moving the automatic selector unless the brake pedal is pressed.
Conclusion
- In a car with a manual gearbox (as well as a robotic manual), engaging reverse while moving won't work—there won't be enough force. And if you persist, you can bring the gearbox to the point of needing repair.
- In a car with an automatic (as well as a CVT), reverse won't engage because sensors report the speed and direction of travel to the "brain" of the automatic transmission, and based on this data, the gear is selected. As long as the sensors work—the "automatic" will never engage reverse while moving forward (and if the sensors fail, the car won't move at all).
So to the question "what happens if you engage reverse while driving?" the answer is one: nothing will happen!








