Hard stool that stays in the colon for more than a couple of days is called "fecal impaction." Most medical sources recommend treating it with manually removing the stool (by a doctor, if necessary) and using rectally administrated enemas:
Softening of hardened stool and stimulation of evacuation with enemas
and suppositories is often helpful...Most enema solutions contain
water and an osmotic agent. One such combination contains water,
docusate sodium syrup...and sorbitol... Rectally administered
solutions mechanically soften the impacted stool and the additional
volume gently stimulates the rectum to evacuate (Clinics in Colon and Rectal Surgery).
You can also check the "Fecal Impaction" part on Mayoclinicproceedings.org.
According to American Family Physician:
Fecal impaction should be treated with mineral oil or warm water
According to some studies, oral stool softeners may also help to remove hard stool (ScienceDirect).
Oral disimpaction can be accomplished by high doses of stimulant
laxatives, docusate, mineral oil, and polyethylene glycol-electrolyte
(PEG) solutions. Osmotic laxatives such as lactulose or sorbitol can
be used in combination with other medication. Oral disimpaction is
often associated with abdominal pain and colic, as well as an initial
increase in fecal soiling.
The problem with oral softeners, stimulants and osmotic agents is that once you take them, you can't go back..They can cause severe bloating and abdominal or rectal pain, so one needs to judge carefully what to use. In fecal impaction, oral softeners can increase the amount of water in the intestine, but not necessary in the hard stool itself. This may cause pressure to push the hard stool out, which may not be successful and can be painful.