It is not recommended to travel on pending OPT/STEM OPT, but it is possible. According to the ICE.gov website on travel:
Can I re-enter if my request for OPT is pending?
Yes, but traveling during this time should be undertaken with caution. USCIS may send you a request for evidence while you are away, however, so you would want to make sure you have provided a correct U.S. address both to your DSO and on the application and would be able to send in requested documents. Also, if USCIS approves your OPT application, you will be expected to have your EAD in hand to re-enter the United States. Like a request for further information, USCIS can only send the EAD to your U.S. address.