She got to know Brecht in 1922, the same year she came to Berlin. She began collaborating with him in 1924, and is listed as co-author of The Threepenny Opera (1928). She purportedly wrote the majority of the text as well as providing a German translation of John Gay's The Beggar's Opera, on which the musical play is based, as working material for Brecht and Kurt Weill, the composer. She reportedly wrote at least half of the Mahagonny-Songspiel, but was not credited. She was the main text author of the musical comedy Happy End (1929).
Because of the rise of Nazism, Hauptmann went into exile in the United States from 1934 to 1949, marrying German composer and conductor Paul Dessau in 1943. After Brecht's death in 1956, she published works of his at Suhrkamp Verlag, a German publishing house, and worked as a dramaturg for the Berlin Ensemble. In 1977, a collection of her works was published under the name Julia ohne Romeo (Julia without Romeo). In 1961, she received the Lessing Award, which the Ministry for Culture (East Germany) awarded every year. She made a German version of He hanshan (The Confronted undershirt), a Yuan Dynasty-era Chinese play.