T here are some medications that cause problems for dogs like lack of control over their bladder or sphincter. An example of such a medication is prednisone - a steroid that relaxes control of the smooth muscle of their bladder and/or bowels.
Under such a condition your dog may become prone to accidents. You need to reassure your pet that you are not mad at him and give him extra love and understanding. If need be, you can use a potty pad or doggie diaper.
Other problems owing to medications can be kidney failure.