The Question and Answer section for The Scarlet Pimpernel is a great resource to ask questions, find answers, and discuss the novel.
They do not actually "fall in love" until Margurite finds out Sir Percy's identity as the Pimpernel. Before that, Percy lives under an alternate ego or personality and is not close with his wife.
The story begins shorty after the advent of the French Revolution in a time know as the "Reign of Terror".
Margurite is married to him. I suppose that accounts for some loyalty. It isn't until much later in the book when she discovers that Sir Percy is actually the Pimpernel.