Cushions are sometimes so massive that cramming them in a washing machine will not give them a decent cleaning. Worse yet, they might rip. If cushions are so large that they cannot adequately spin in a machine, then they may not properly rinse. That will leave you with a soapy cushion that needs to be washed by hand—doubling your work and time. However, if a cushion properly fits in a washing machine, then by all means use that cleaning method. Use regular detergent and make sure to set the machine on the gentle or delicate cycle. A faster cycle could damage the cushions.
Most foam and other batting inside cushions will not be damaged by a washing machine. However, as previously stated, always adhere to any instructions provided on the cushions.
Besides ripping or soapiness, the biggest risk associated with using a washing machine is that the cushions won't dry entirely. Damp cushions can attract mildew and give off an odor if simply placed back in their spots on the couch. Placing damp cushions outside in the sun will give them a refreshing smell and ensure they dry completely.
Try to avoid putting a cushion inside a dryer. Dryers are the main culprit in causing the bunching that makes a cushion lose its shape. If you must put a cushion in the dryer, use the "no heat" or "air dry" settings and also put a tennis ball wrapped in a pillowcase inside. This technique helps the cushion keep its shape.