No, The Simpsons did not predict the 9/11 terrorist attack on the World Trade Center. But it is an eery coincidence in retrospect. The episode in question is "The City of New York v. Homer Simpson" airing in 1997. The plot features the Simpsons traveling to New York City in order to retrieve the family car which has been abandoned in the World Trade Center's parking lot by Homer's alcoholic friend, Barney. While cajoling Homer to take the trip to the city, Lisa, the elder daughter, hold up the magazine screen capped above.
The magazine advertises bus tickets to New York for $9. The nine is positioned above and to the left of the twin Towers of thee World Trade Center. If you imagine the Twin Towers as numeral ones, then 9/11 can be clearly seen. However, the illusion of a 9/11 in the magazine cover is only meaningful after 9/11 occurred. Otherwise, there is no pattern to be found.
This is a form of confirmation basis in which we begin piecing together patterns in the past in order to fit current reality. If you look hard enough in hindsight, you can see “accurate” predicting elements with great clarity. Think about how often Nostradamus, to name the most famous example, has had his allegedly prescient quatrains re-interpreted to fit events after they have allegedly occurred. I say allegedly because the same quatrains are likely to be re-interpreted countless times in the future.
The Simpsons is not the only source allegedly predict 9/11. if you would like to see more with varying degrees of connection to the terrorist attack, here is a list of movie, television episodes, artwork, and games. Let me reiterate I do not believe any of these examples legitimately predicted 9/11. I just think it is an interesting coincidence. We live in a strange world where the seemingly impossible happens quite frequently.