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-3 and Moulin Rouge."
McGregor was on stage last night in a different role when he duetted with Robbie Williams on a version of hit song Angels at a celebrity-filled Halloween charity ball.
The pair got up on stage at the event in central London, which raised around £1 million for Unicef's work with children in Syria.
McGregor told fans he had "a great time", tweeting: "We sang Angels. What a moment."