You don't need to poop or change your bathroom habits before a prostate exam.
If you need to use the bathroom, or if using the bathroom before the exam will make you more comfortable, you can.