The actor, who shot to fame in Trainspotting, will appear in the 1982 play about a campaign to free a Scottish soldier imprisoned for burning a memorial wreath during a protest.
Todd Haimes, artistic director of New York's Roundabout Theatre Company, said he was "thrilled" McGregor would be working with them.
He said: "Ewan is an accomplished film actor whose credits range from independent, art-house films, like Beginners and Trainspotting, to huge studio blockbusters including Star Wars: Episodes 1 to 3 and Moulin Rouge."
McGregor was on stage on Thursday night in a different role when he duetted with Robbie Williams on a version of hit song Angels at a Halloween charity ball.
The pair sang at the event in central London, which raised £1 million for Unicef's work with children in Syria.