Can I use pressure treated lumber to build a wall?
Yes you can, but there are things you need to keep in mind. Pressure treated lumber requires hot dipped galvanized nails to fasten it in place. The treatment will rust regular nails to the point over time, they are worthless. So that being said, anything else you fasten to that material needs to be hot dipped galvanized or at least rated for use in ACQ/treated lumber.
As a mention, if you used them for the king studs and not the jack studs then the drywall or doors would have regular wood to fasten to. Just be certain to use the proper nails or fasteners to set it in place. No need to take chances