On Tuesday, the labour court in Frankfurt had turned down management's application.
It is the first time in the long-running 18-month dispute between management and unions that such an injunction has been granted.
Lufthansa said 140,000 passengers were grounded and 1,000 flights were cancelled Wednesday on the second day of the pilots' two-day strike.