Isolating high voltage/high power electronics from low power electronics
Microcontroller input pin can supply or take in a maximum value of around 20mA but varies depending on the controller you are using and same can be said about voltage whose limiting value is normally 5V , you can check data sheet for such specs. FPGA and good controllers minimize the transient response acting upon the input.Baseline is that if you use you device within the limits , transient are less likely to happen or the device has precautions to deal with these minimal fluctuations.In PIC there is threshold value called brown out voltage which tells your controller to power it self when input power supply has a value more than the threshold and can safely be assumed to be stable.  

Sometimes it is necessary to connect high voltages to your controller ADC through a scaling circuit that gives output from 0 to Vref (In PIC default Vref is Vdd). 

Sometimes you need to run motors with high current ratings and for that you isolate your controller by either using an opto-isolater to achieve this

OptoIsolator Circuit 


   

When LED turns on ,  collector and emitter are short circuited 


You can also use high power MOSFETS for isolation as  no current will drawn from the controller due to very high input gate impedance, but this option depends how much  current is drawn by the load through the Drain and Source terminals of mosfet .You can operate to maximum of 30A as suggested by Id vs Vds Graph in this link HERE but datasheet should be referenced for specific products       

Then there relays that are widely used  but their switching speed is slow as compared to transistors but are made to operate fast using a voltage doubler circuit with relay