This medication is used to treat occasional constipation. ... Stool softeners such as docusate are often the first method used for preventing and treating this type of constipation. Docusate is often used when straining to have a bowel movement should be avoided (e.g., after a heart attack or surgery