“My husband recently said he did not love me at all. He said he had not loved me for a long time. It hurts so much. Why would he do that?”
I am sure he loved you when he said he did. When he said he did not love you he must have been upset and could not remember previous feelings of love. It happens to all of us, when things are good, we "delete" the bad from the past and when things are not nice we forget they used to be good.
Think of yourself. It does not matter what he said in the past or what he said about it. The only thing that matters is what you do with it NOW!
Do what is best for YOU. You are important. It hurts to hear things like that and he was not being very sensitive. Forget about what he said in the past. Look forward.
Ask yourself what you can do to go back to the love you had at the beginning of your relationship. I am sure you can find something there.
Stay strong and remember that all obstacles are stepping stones and they will make you stronger.