How do you install a slide lock when the door frame isn't level with the door?
The best solution, of course, would be to fix the door frame, but this would take a lot of work.

It appears that the door jamb is metal, and slightly wider than the part of the lock that accepts the slide? If so, find a piece of filler material (perhaps a layer or two of metal bar stock/billets), that will thicken the door jamb to meet the door. Use some longer sheet metal screws to attach the part to the door jamb. Be sure to drill holes in the filler material so that the screws easily go through the metal stock, so that they can dig into the door jamb itself.

Note that you may need to use fairly large screws to fully secure the lock. If smaller screws are used, one could easily kick open the door as the heads off the screws will easily pop off given reasonable force.