To remove wood pitch, use mineral spirits (paint thinner). It's safe to use on most everything, but you should test it to make sure it won't leave a mark. The easiest way is to put some paint thinner in a spray bottle and spray it on the pants. It should soften up the pitch and allow you to wash it out.(You might need to retreat the area until the pitch thins enough to remove.)
Before you put the clothes in your washing machine, wash out the thinner with plenty of soap and water. It's greasy, but it will wash out. Once all the thinner is gone, you can wash it in your machine like you normally do.