He went to Pilate and asked for the body of Jesus. Then Pilate commanded it to be given to him. Bible see other translations

“Then Pilate commanded it to be given to him.” From a Roman perspective, Jesus was a criminal, and after his death his dead body would have been simply thrown into a pit with the other criminals who were crucified that day and all of them would have been buried together and forgotten. Of course, if a family member or friend wanted a body, he could have it. Thus, when Joseph asked Pilate for the body of Jesus, it was given to him. The whole arrest, trial, and crucifixion of Jesus seems to have caught Mary and the apostles completely off guard, and they were not prepared for his death, nor were the apostles prepared to publicly step forward and get the body. From a Roman legal perspective, after Pilate gave Joseph the body, it belonged to him and he could do with it as he pleased.

Commentary for: Matthew 27:58