"It is impossible to think about that."
Translation:Il est impossible de penser à cela.
I've tried to find a good answer for you, but mostly you just have to learn which phrases are followed by "a" and which are followed by "de" https://www.frenchtoday.com/blog/french-verb-conjugation/why-french-verbs-followed-preposition-a-infinitive
Aside from the strange thing that French sometimes requires 'de' or 'à' after a verb, there is the fact that you want to include the entire phrase "penser à cela". So, using 'de' leads into the phrase.
I thought of Ce n'est pas possible de penser à ça. I wonder if it's accepted.