Is your child potty trained? I had a problem with my son and constipation also. He was on miralax for probably a year, once he got over being scared of the toilet he hasn't had any constipation issues!
Rockrose is correct. She is holding it in because she is constipated and it really hurts her to go and she wants to avoid the pain.
This is a link to an article that pretty well covers all the bases.
http://www.practicalgastro.com/pdf/November02/LoeningBauckeArticle.pdf
I think you need to get real medical help, to determine if she's "holding it in", or if she has a physiological problem with bowel movements.
If it can be determined that she is purposely withholding, then you probably need to get psychological counseling. But honestly, it's usually a physical problem.