YES! Since pee (urine) leaves the body from another opening called the urethra, you don’t have to remove a tampon from your vagina to pass urine. You can also leave your tampon in when you have a bowel movement.
*See diagram below to see where the urine leaves the body.

Test your knowledge about tampons- https://youngwomenshealth.org/2015/02/03/tampon-quiz/