The gun must fit The Box (8.75" x 6" x 1.625") with magazine in place. I don't know if a P239 with single stack 10 round 9mm magazine will do so, but you should before you stock up.
You must use the same magazine capacity throughout, not an 8 to fit The Box and 10s otherwise.
I would not buy a P239 for the purpose, but if that was the best gun I had, I would definitely shoot it for IDPA. I have seen some in use.