Ketel Marte and the D-backs have agreed to a contract extension that runs through 2031, a source told MLB.com on Wednesday.