What happens if I set the wrong pinMode?

Consider a hypothetical situation: You have an arduino project with a simple series circuit, an output pin going to an input pin. A switch is in between, and it has to be an output pin so you can disable the circuit at any time. What happens if you set the one that should be input to output, with no current running on it (state == low), and current running on the other output?
Will this damage the microprocessor?

A shortcut between pins is bad and can damage the microcontroller or processor. In real life there will probably no smoke and perhaps nothing gets damaged.

In these situations a protection resistor of 220Ω to 10kΩ is often used in the signal line.

Sometimes a circuit is not okay, and short glitches of shortcuts can happen. Those circuits usually keep on running without problem. But it is not nice to go beyond the limits of the chip.

When two pins are set as output and both are low, then nothing happens.

Ok. What about if one is set to input and the other is set to output - the output being high?

That is no problem at all.
For a 5V Arduino board, the input pin can be 0...5V. The inputs have a very high impedance, there is no current.

A protection resistor could be helpful, to avoid problems when both are accidentally set as output.

A serious problem is this situation:
Suppose a battery of 3.7V is connected to a analog input to measure the voltage, but without protection resistor. Then the Arduino is turned off and the battery stays on. There will be a large current into the analog pin and the Arduino might turn on or might get damaged.

Thank you! I'll remember that.