It's not that synthetic detergents do not make any bonds with the calcium and magnesium ions present in hard water. It does make, however the salt that is formed with this bond is water soluble (note that the synthetic detergents are composed of long straight chain hydrocarbons which is hydrophobic and the ionic sulfonate group which is hydrophilic - the salt formed from hard water is thus water soluble) which gets drained away unlike salts that forms when soap is used which is insoluble and forms scum like precipitate. Hence you will see detergents making more lather than soaps.
See more details here: Why sulfonate of detergent is less likely to bind to ions present in hard water than carboxylate?