That depends on the reason for your dentist's recommendation.
If your dental fillings are defective or show decay, it's important to replace them. Untreated decay may eventually lead to an infection (abscess). In some cases, replacing a dental filling may benefit the long-term health of your tooth.
Most metal dental fillings are dental amalgam — a stable alloy made with mercury, silver, tin, copper and other metals. Although concerns have been raised over the years about the safety of mercury in dental amalgam, there is no conclusive evidence to support that you're better off having amalgam fillings replaced with alternative materials. The American Dental Association supports the use of dental amalgam as a safe, reliable and effective treatment for dental decay.
Dental amalgam is often used to fill large areas of decay on back teeth. Generally, replacing metal dental fillings for cosmetic reasons should only be done after careful consideration and if your dentist feels it won't compromise the long-term health of your teeth. Likewise, there's no need to replace metal dental fillings because of concerns about mercury in your fillings.
If you're unsure whether you need to replace your metal dental fillings, ask your dentist to explain the options and help you understand what's best in your case.