There is not much we can do about this error on our end but there are several things you can do to address it on yours. The merge operation is limited by Salesforce to 100 SQL queries. Each time the system has to re-parent an object it costs at least one query. So for each custom object you have associated with a contact record is going to require 1 query to reparent as part of the merge. Limiting the number of custom objects is one potential guard against getting this error.
Another work around would be to manually re-parent related objects before the merge. If one of your contacts has a lot of donations for example manually moving them to the master record before the merge will save a few SOQL queries in the merge process.
Also, if one record has a lot of related objects associated with it while the duplicate record does not, making the record with the must objects associated with it would be best practice. If you make the record with a lot of objects associated with it the duplicate and not the master the system has to reparent all those objects which requires a lot of queries. Choosing the record with the fewest objects associated will cut down on re-parenting and allow the merge to go through.
We are somewhat at the mercy of Saleforce limitation on these merges. Our Engineering teams are continuously looking into how to improve the system and to circumvent the various Salesforce limitations. The above suggestions should allow you to get around them as well.