The Red Sox and Nationals announced the trade late Thursday. Schwarber, who is on the injured list, owns a .253 average with 25 home runs and 53 RBIs in 72 games this season. He earned his first All-Star selection for his first-half performance in 2021.
The longtime Chicago Cubs catcher signed a one-year deal with the Nationals last off-season. He spent the first six years of his career in Chicago.
He owns a career .233 batting average with 146 home runs in 623 appearances. Schwarber hit a career-high 38 home runs in 2019 for Chicago.
The Nationals placed the 28-year-old outfielder on the injured list in early July due to a right hamstring strain. He is expected to return in August. Schwarber's contract includes an $11.5 million option for 2022.
Ramirez, 20, posted a 2.03 ERA in eight games for Class A Salem this season. He is on the seven-day injured list. The Red Sox designated right-handed pitcher Brandon Workman for assignment to make room for Schwarber on their 40-man roster.
Ramirez was the Red Sox's No. 19 prospect, according to MLB Pipeline.
Sources told MLB.com, ESPN and The Athletic on Thursday that the Nationals also are finalizing a deal to send ace pitcher Max Scherzer and shortstop Trea Turner to the Los Angeles Dodgers in exchange for several top prospects.
The Red Sox (63-41) face the Tampa Bay Rays at 7:10 p.m. EDT Friday at Tropicana Field in Tampa, Fla. The Nationals (47-55) host the Cubs at 7:05 p.m. EDT Friday at Nationals Park in Washington, D.C.