Ignoring the specific radio for now and using the US rules as set up by the FCC. To use any radio on ham frequencies, you need a ham license. To use any radio on GMRS frequencies, you'll need a GMRS license. To operate on FRS frequencies, you need no license (assuming that your radio follows those for FRS use) or a GMRS license (to operate under the less strict rules that GMRS has for them). To operate on MURS frequencies, you need no license. To operate on Part-80 (Marine) frequencies, you need no license if on water and a land station license if on land. To operate on Part-90 (PD, FD, and most business radios), you need a business radio license and operate in the area that license specifies.
Be aware that several services have specific requirements for radios that operate on that service. Ham radios do not need any special certification so most radios are allowed. Part-80, Part-90, GMRS, MURS, and FRS radios must be certified to be legal for someone to operate on those services (each service had their own certification so just because one is certified for use on one, it still isn't legal for use on another that isn't certified). This is to make sure that a radio not only doesn't cause interference on (or near) the assigned frequencies for that service, but also that it follows the special rules that service may have (power levels, modulation types, non-removable antenna, etc.).
The Baofeng UV-5RTP can be legally used on ham frequencies (no special certification required). It also is certified for Part-90 use (be sure to get written permission from the license holder or holders for the frequencies in question and have the radio programmed properly to operate under those licenses). It is not certified for use on MURS, Part-80, GMRS, or FRS frequencies.
Many do not care about using a non-certified radio on the services that require this certification. Many others believe that the certification of the cheap Chinese radios like the Baofeng were obtained using false information and are therefore should not have been granted by the FCC. Since your post asked about legal operation, I provided information on how and where it would be legal and not. Will you get caught using a non-certified radio where one is legally required? Probably not, but if you do (normally as part of other investigations), the FCC will be happy to take your $10,000 per violation (often read as each day of operation with that violation).
Please keep to the topic in question, and use the many other threads to discuss the certification issues unless they specifically address questions asked in post 1 of this thread.