Hanns Heinz Ewers was in the United States of America for the entirety of the War. He would say that he did not want to risk the Atlantic crossing because the British Navy had the habit of searching ships for any Germans who looked as if they might be trying to return to join the German war effort, and putting them in British internment camps.
Ewers did his own bit for the German war effort without crossing the Atlantic. He wrote articles for German and English-language publications which publicised the German point of view, and made contacts with the numerous supports of Germany in the USA, who campaigned for America’s neutrality. He wrote a book, Yankeeland, that was effectively propaganda (but was never published). It may be that he was more than just a German propagandist. He may have travelled to Spain on a false passport; he may have travelled to Mexico, perhaps to incite Pancho Villa to attack the USA to divert the country away from European involvement.
Ewers’ efforts did not go unnoticed by America’s security forces, and when America had joined the war against Germany Ewers was arrested, and was put in various prisons in New York and, in July 1918, sent to the internment camp Fort Oglethorpe, in Georgia. He was never actually tried as a German agent; which, indeed, he might well not have been. He stayed in Georgia, his health undermined, until he was allowed to leave for Germany on 3 July 1920.
He finished his third Frank Braun book while in Germany. He also met with the occultist Aleister Crowley (with whom he kept up a correspondence); with the man who became a friend and would later be a supporter of Adolf Hitler, Ernst “Putzi” Hanfstaengl; and with the woman he would marry on his return to Germany, Josefine Bumiller.
The information here comes so far largely from the German Wikipedia.