What happens when you set a pin in the wrong direction?
Yes, if you configure a controller's pin as output when it has a low impedance circuit attached you may damage the controller.

For example if the circuit attached is a opamp (or a switch to either supply rail,) it is possible the current in both opamp output and controller pin exceed its maximum ratings and that may damage the output driver. Check the related datasheets for maximum ratings. 

Usually a small series resistor is perfectly acceptable. For example an ATtiny can source/sink 40mA at 5V. \$R = \frac{U}{I} = \frac{5\text{V}}{40\text{mA}} = 125\Omega\$. Round that value up to the nearest E12 value and you get \$150\Omega\$ as a series resistor. Most circuits will work perfectly well with that and at the same time it protects your output drivers while experimenting. Notice that the opamp example I used may have different maximum rating. Always choose the lowest current / highest calculated resistance.