Drink plenty of water per day. It helps to push stool and makes them soft.
Exercise daily - Sedentary habits can cause constipation. Do daily exercise or yoga like Vajrasan, Pavanamuktasana, Bhujangasana, Halasan etc
Eat High fiber food - Whole grains, Fruits like banana, Apple, Pear, Vegetables like Spinach and beans.
Probiotics- Probiotics, like curd and yogurt has beneficial bacteria found and other cultured foods, have long been touted for their ability to ease digestive.
Avoid Stress, Eating Disorder, Late sleeping, avoid antidepressants, get investigated and take medication for existing diseases like hypothyroid. Don't ignore the urge to poop.