The legs were broken to hasten death. The crucifixions took place during the day, and it was getting dark, and the soldiers wanted to go home. By causing such extreme pain the crucified lost consciousness and died.
The thieves died before such measures were necessary.