What is wrong with a 1999 Kia Sportage that will not start unless the lights are turned on for a while before starting?

I would try cleaning and tightening your battery terminals, use a terminal cleaner or wire brush until you can see fresh metal on the connectors and battery terminals and check the wires to make sure the corrosion has not started to go inside. Batteries are funny sometimes, a little corrosion will prevent a big charge from getting to the starter but if you use something else first like your headlights and establish a connection it will allow the big surge to happen. I just had this happen to my 99 Sportage. Check the Mass Air Flow Sensor. My truck would sometimes start, but most time I needed to let it "prime" (turn on only to acc. and wait 3 seconds before starting). My MAF was dead! After replacing it, the truck starts perfectly.