How do SJR and Web of Science journal rankings and quartiles differ?
Presumably, when you say SJR quartiles, you mean the rankings presented by Scimago. I previously posted details about how journal ranks and quartiles are estimated on scimago. 

There are several key differences between WoS and Scimago that lead to different journal ranks (and quartiles):


Database of journals: WoS rankings uses web of science indexed journals and I think Scimago uses Scopus ISI indexed journals. Scopus is much more inclusive than WoS and also provides better coverage in some disciplines (e.g., social sciences) than WoS. In some disciplines, simply being listed in WoS suggests that the journal is at least a reasonably strong one in the discipline.
Source of citations: Indexing different databases mean that the citations used to evaluate journals are also based on different databases of articles. WoS has a more exclusive set of journals and the coverage is not as balanced across the sciences. The consequence is that metrics based on citations per year per article (e.g., impact factor, citescore) will be higher when using Scopus, and this difference will be amplified for social sciences and other disciplines with less WoS coverage. However, although journal metrics based on citations per year will be lower in WoS, this in itself wont necessarily affect journal rankings within disciplines, because in many cases all journals within a discipline will be broadly influenced.
Definition of an article: I believe that Scopus/Scimago and WoS define articles differently. In particular, I believe that Scimago categorises some items as articles that WoS does not. In general, most citation metrics have a formula that divides citations in a given period by number of articles. I believe this scopus approach reduces citations per year indicators for some journals that include a lot of non-standard article types (e.g., Nature and Science).
Metric: Irrespective of the database of citations used and definitions of what is an article, impact factor and SJR are different citation metrics. See my previous answer about how SJR works. In short, SJR is based on a 3 year window, and impact factor is based on a 2 year window. SJR also has a bunch of corrections to reduce discipline-specific differences in citation practices and a way of weighting certain citations more highly (based on the prestige/impact of source). While I think SJR is much better than impact factor, this might not change within discipline rankings too much because most of these differences between metrics address discipline-level differences.


So, why is it that a journal can be Q2 in Scimago and Q4 in WoS? I think this is most likely due to the database of journals used. WoS is more exclusive and particularly deficient in certain disciplines. So for example, a journal may have a reasonable reputation (e.g., ranked 35 out of 100 in Scimago), but only ranked 35 out of 40 in WoS, because there are a whole pile of journals in Scimago that aren't even listed in WoS.

Which indicator of journal quartile is more valid?
First, I think that SJR as a metric of impact and the more inclusive journal database are better and make the sicmago metrics of journal impact more valid. Of course, at some point, you need to ask about what it means to speak about the rank or quartile of a journal. What should the criteria for membership in the population of journals from which a rank is obtained? The WoS criteria is quite high. Most people would agree that predatory journals with no legitimate peer review should not be included. 
I think an argument could be made that Scopus / ISI is sometimes too inclusive (e.g., it includes some journals that have questionable peer review). But I think the stronger argument is that WoS is too exclusive. So perhaps  the Scimago/Scopus interpretation aligns more naturally to what we might think of as a rank or quartile. I.e., of the legitimate journals (or at least, reasonably legitimate) in a discipline that are published, where does a given journal sit.

What quartile is typically used? It's difficult to say how people will interpret a statement like "this journal is Q1" without you specifying the source. It's a bit like when you say "this article has 50 citations", but you don't say which database this citation count is based on (e.g., WoS, Scopus, Google Scholar). 

In contexts where it matters, you should clarify which source you are relying on. That said, my impression is that the Scimago quartiles are becoming more popular. For example, at my university we are encouraged to mainly publish in Q1 journals, where quartiles are based on Scimago.

As a minor practical point, access to WoS citation metrics is by subscription only and the user interface is terrible. In contrast, the interface for scimago is public and quite user friendly.