This depends on what type of sound you want to achieve. In general, a 2-ohm subwoofer will usually be louder, while a 4-ohm model will deliver better sound quality.
An ohm is a unit of resistance and, in this case, it’s the resistance to the audio signal coming from the amplifier. Two ohms offer very little resistance so a lot of power goes through, resulting in a loud sound. On the other hand, 4 ohms are more difficult to bypass, making the sound weaker but much more concentrated (higher quality).