Barnes, an outfielder from Texas Tech who hit .325 with nine home runs and 49 RBIs last season, was the 45th overall pick.
Barnes left Houston on Thursday afternoon with plans to undergo a physical and officially sign on Friday.
Sandfort, a right-handed pitcher from Winter Springs High School in Florida, has been assigned to the Gulf Coast League Pirates. He was 8-1 with a 0.92 ERA and 72 strikeouts in 68 2/3 innings last season.
"The Pirates are excited to add the athletic and physical presence Jon Sandfort brings to the baseball field," Pirates director of amateur scouting Joe DelliCarri said in a release. "He possesses many positive traits needed to excel at pitching for a long time."