Do all aircraft need to have horizontal and vertical stabilizers?
Depending on how you classify the control surfaces, the B-2 Spirit does not have a horizontal stab, since it is a "flying wing" design.  As you have changed the question, the other part of the answer is that the flying wings have been able to get by without vertical stabilizers as well, at least in the case of the B-2. It uses both spoilers ("split brake rudders") and thrust differential to accommodate the lack of a vertical stabilizer.  


  Northrop had investigated several means of applying directional
  control that would least infringe on the aircraft's radar profile,
  eventually settling on a combination of split brake-rudders and
  differential thrust ~  Sweetman, Bill. "Lockheed Stealth" (2005) ISBN 0-7603-1940-5., p. 73


(And as with flight controls in general on the on B-2, that's helped a lot by its fly by wire flight control system). 

 

As the Germans discovered in their flying wing aircraft (Ho229), and the USAF in the YB-35 and YB-49 programs, flying wings have inherent instability, even though some early biplane "flying wing designs" were stable enough to fly. (Dunne). 
 

The B-2 has a fly by wire system to retain stability and handling qualities so that it does not have to make tradeoffs (loss) in performance that earlier flying wing designs did in order to make the design "stable enough."    

What the elevator/horizontal stab do for conventional aircraft is allow for longitudinal control (pitch control).  If you don't choose to use that conventional method, the "effect" is that your design must find another way to establish longitudinal control and stability or the aircraft risks being unstable in that axis.  

Likewise with vertical stabilizers, your design has to address stability in the yaw axis if you want to make it without a control surface acting in that axis.