From X-Men, we know that Wolverine was Canadian but in one movie (I think the X-Men Origins) why did he (and his brother) participate in American Revolutionary War and American Civil War on the side against British and Confederacy?
Wolverine and Sabretooth were not in the American Revolution. They were born in the mid 1800s, nearly a century after the Revolution (1775-1783). The first scene of X-Men Origins: Wolverine takes place in 1845, when Wolverine is seemingly a pre-teen (typical age mutant powers emerge).
The American Civil on the other hand, did have James and Victor fighting in it. For the most part, they are both nomadic, hot blooded, strong males of fighting age, and a war would call to them like flames to a moth. They are the eternal soldier type.
Even though they are Canadian by birth *, as evident by their participation in most major wars (American Civil War, The Great War/WW1, WW2, Vietnam), they want to be in the middle of a fight. That said, Canadians were plentiful in the American Civil War, due to multiple issues. Their presence is not unrealistic.
Of course, Wolverine, in the comics and cartoons, has a long history of being a soldier, being seen helping Captain America liberate Jewish prisoners (including Magneto/Erik Lesner) during World War 2 multiple times. Even then, he's wearing Canadian flags. Canada, like always, has participated in most major wars, without much notice, due to smaller contingents. Canadians were present in WW2 and even modern day Iraq/Afghan "wars".
*Note: Canada didn't exist as a nation at the time; it was still a group of separate British Colonies.
According to X-Men Origins: Wolverine (which is very loosely based on the Origins comic series), Wolverine was born James Howlett in Canada in the late 1830's. In 1845, he sees his father murdered by their groundskeeper, and that triggers his mutation to activate: bone claws, regeneration, etc. It's at this point that Howlett and his half-brother Victor Creed flee from Canada.
The two of them move down into the United States and decide to join the US military as, in essence, mercenary soldiers. Obviously, they were born much too late to have fought in the American Revolution. However, they did serve in the US military during the Civil War (as Union soldiers), both World Wars, and Vietnam. This would have given them steady work, food, shelter, etc., and would have fit well with the mutant powers they were trying to hide.
In the modern US military, the two of them would have been required to obtain legalized resident alien status (what most people call a "green card") to enlist, but that requirement hasn't always been quite so strict. It's estimated that:
were non-citizens. Remaining in the military through the end of the Vietnam War would probably have been a bit tricky, especially without proof of birth or anything like that, but we can suspend our disbelief a bit there and just assume the two of them figured out how to deal with their immortality by that point.