Is it still possible to produce a child after having chlamydia for almost 2 years before treatment?

Yes. Chlamydia may cause tubal scarring that may lead to infertility. Testing can be done to verify the tubes are open.
Possible but... Best to assess tubal patency (hsg, laparoscopy) if unable to conceive after 6-12 months. Seek gyn for advise and possible testing.