With Visa and MasterCard, no. They both have rules that limit stores from requiring you to show your ID as a condition of purpose. These rules also make them accept your card even if you refuse to show your ID. However, you may still be required to show ID for other reasons related to the sale, such as for buying alcohol/tobacco, using a card flagged as lost/stolen, suspected fraud, etc.
If someone insists that you show your ID to use your credit card, you can show a copy of the Visa or MasterCard rules.
220.127.116.11 Cardholder Identification
Unless specified in the Visa Rules, a Merchant must not request Cardholder identification as a condition of purchase... a Merchant that suspects fraud in a Face-to-Face Environment may request Cardholder identification. If the identification is expired or does not match the name on the Card, or if the Cardholder does not provide identification, the Merchant may decide whether to accept the Card.
5.10.4 Additional Cardholder Identification
A Merchant may request but must not require a Cardholder to provide additional identification information as a condition of Card acceptance, unless such information is required to complete the Transaction, such as for shipping purposes, or the Standards specifically permit or require such information to be collected.