This is another classic "it depends" answer. Every dental implant and orthodontic case is different, with varying conditions, and goals for the outcome.
Most often, however, it is best to move the teeth to an ideal position (orthodontics) creating the appropriate spaces and anatomy, then place the implant.
However, it is quite common that dental implants are used as anchors for the orthodontic treatment. And, in those cases, the implants are placed first.