How can I repair the carpet around a new shower?
Ignoring the fact that carpet in a bathroom is just a bad idea, I see two options:


Install a threshold to cover the gap 

(source: abbey-carpets.co.uk)  
You might be able to put down a new tack strip and stretch the carpet.  This will really depend on how large the gap is (you didn't say)



(source: homedepot.ca)