I have a long-duration EMG signal (~4 hours long) with a sampling frequency of 1 kHz. If I want to filter the data with a low-pass filter in 10 Hz in MATLAB, should I filter the signal with moving window? I am using Butterworth (4th order) IIR filter.
First, I'm assuming that by "moving window", you mean breaking the signal up into smaller chunks and filtering each chunk separately. In the signal processing word, "moving window" would often mean an FIR filter (e.g. fir1() in matlab), but because you explicitly said you are using butterworth filter, which is an IIR filter, I assume that is not what you are talking about. If I am wrong, please edit the question to clarify.
Now, 4 hours at 1000 S/s would occupy about 100 Mb of ram. That's big, but not outlandish. Assuming you have a 64 bit processor and a decent amount of RAM (2 GB or more), there is no reason to break this up into smaller chunks. I filter vectors of 100 MB in one single pass (i.e. without breaking them up) all the time. Any computer built within the past 3 or 4 years should be able to handle this just fine. 10 years ago the answer would have been different.
The short answer is you should not use a moving window because the moving window itself creates a low-pass-ish filtering effect.
But as @DanielKiracofe already stated you could slice the signal up into smaller segments and filter those. Of course you need to be careful that the your window size fits your low-pass filter.
However, in order to circumvent the problem of stitching the slices together I would use a short segment (duration: 10s) of the signal to test your code and and than run filtfilt on the whole signal to reduce phase-shifting.