Mosley didn't definitely commit treason under British law. The only conduct where a charge might have been found would be:
- adhering to the sovereign's enemies, giving them aid and comfort, in the realm or elsewhere.
Since he didn't do anything like that after the outbreak of war, a charge wasn't available. British law tries hard not to punish people for thoughts or feelings, only for actions. The government sometimes decides not to hire people "on security grounds" because it feels their opinions make them liable to commit particular actions, but that's different from imprisoning or executing them.
Up to the outbreak of war, Hitler was the head of state of a foreign country that was presenting an increasing risk of war. Many people met him, but that isn't anything in itself which they could be punished for. Giving him military information would be espionage, but Mosley doesn't seem to have done that; passing on political gossip is not spying.
Since Mosley was regarded as presenting a risk in time of war, and was campaigning in favour of Hitler's "peace" offer of October 1939, he was detained without trial under Defence Regulation 18B from May 1940 to November 1943. This would not have been legal in peacetime. Most of the public seem to have approved of this. Other active fascists were likewise interned.
Hitler's October 1939 "peace" offer was not regarded as credible by the French or British governments of the time. He'd made many commitments while Chancellor of Germany, and broken many of them as soon as he had the military strength to do so.
A temporary peace would give Germany a chance to grow stronger. As a dictatorship, it appeared that Germany could commit more resources to a military build-up than a democratic state. Germany did not fully mobilise until years later, but that wasn't understood by its opponents at the time.