The Argentina international fired a low shot into the bottom corner after 10 minutes but limped off soon after with a muscular problem.
Juventus coach Massimiliano Allegri said after the game that Dybala and his strike partner Alvaro Morata, who also went off injured, are "certain" to miss Wednesday's Champions League clash with European champions Chelsea and Saturday's Turin derby against Torino.
"We hope to have them back after the international break, but this is part of the game," Allegri told Sky Italia.
"Now it happens to us, later it could happen to someone else. We will need to be good to make up for the absences."
Allegri's side climbed to ninth place in the table on eight points, three points clear of 14th-placed Sampdoria but eight adrift of league leaders AC Milan.
"It was fundamental to win today and we won. We say things in the dressing room that stay there, but now we must continue like this," Locatelli told DAZN.
Juventus won their first league game of 2021-22 at the fifth attempt against Spezia on Wednesday, and they started strongly against Samp when Dybala drilled home the opener.
Federico Chiesa shot wide from a good position and Alvaro Morata was denied by Emil Audero as Juve pushed for a second, but their positive start was dampened by Dybala's tearful exit midway through the first half.
Bonucci doubled the lead from the spot after a Chiesa shot struck Nicola Murru's arm, but less than two minutes later Yoshida pulled one back with a header.
The Japanese defender's goal means Juventus have not kept a Serie A clean sheet since beating Spezia 3-0 on March 2.
Dejan Kulusevski pounced on a slack pass inside the Samp box and teed up Locatelli on the edge of the six-yard box for Juve's third. But Candreva's 83rd-minute strike made for a tense ending.