Why would a flight no longer considered airworthy be redirected like this?
There could be a lot of reasons for this...


EU closed airspace to 737's MAX 8's on March 12
They needed to go into a holding pattern until ATC figured out where to put them
They needed to be in the holding pattern until they could get a landing slot
They were redirected to an airport that had a maintenance facility that the airline uses
They redirected to an airport with code-share partners so they could rebook passengers without a major fee


Edit I'm not sure what is going on with FlightRadar24, but it shows that the plane continued to Prague the next day. It looks like they landed in Ankara then continued on to Prague. I'm not sure if the flight to Prague was just a repositioning flight, or if it had passengers.

Edit 2 Turkey subsequently (after this flight) also closed airspace to 737 MAX 8's. The EU closure allows for ferry flights, which are flights without passengers on board. The flight from Ankara to Prague was just a positioning flight so that the aircraft could be serviced when it came time to implement a fix from Boeing.