Well we know darkness is eternal. But eternal can mean 2 different things in this case. It can mean A.) Darkness has always exist and always will, or B.) Darkness didn't always exist before but ever since it's creation it is now eternal and will exist from now on forever.
Now if we assume that possibility A. is true then that means that heartless have most likely existed since the begining of all existence, basically whenever a person first had his/her heart consumed by darkness was when the heartless were first created.
Now if we assume that possibility B. is true then that means heartless came about soon after the creation of darkness. If this is true, then at one point only light exist, now this is hinted at in the series, so whenever darkness was first born in people's hearts, eventually someone's heart was consumed by the darkness and became the first heartless.
My guess is possibility B. is correct and that the first heartless started to appear around the time of the keyblade war. I think when people became greedy over the light of KH, this greed caused darkness to be born in their hearts and eventually some hearts were consumed by darkness and became the first heartless.