"In all their affliction he was afflicted, "
This verse is talking about Jesus, he too was afflicted, just like we are.
So, first of all, what is affliction? It's a cause of pain or harm.
As we suffer pain and harm, so has Jesus. Jesus had temptation and condemnation to deal with too.
Even if we consider a brief summary of his life, we can see much that caused him harm and pain.
To begin with; he was a refugee, his family fled for his and their safety. He grew up moving around. As Jesus got older he was also; disbelieved, mocked, beaten, tempted, falsely accused, homeless, betrayed and abandoned.
That sounds like affliction to me!
Jesus had a lot to be in pain about. So, he can understand us in our affliction. He can truly empathise and walk with us in it because he's been there too.
The verse above tells us that as we suffer, as we experience pain and harm, Jesus also does. This can give us confidence that in our troubles, torment and turmoil we are not alone.
He has been there, and he is there with you in it. He can empathise and walk with you in it because, 'In all their(our) affliction he was afflicted'. It's not just sometimes here's there, he's there in ALL of it.