Is it okay to ask someone for an (electronic) copy of their PhD thesis if it is not available online?
Yes, it is completely fine to ask them, but before you do, it helps to be aware of a few things:


In many if not most fields and countries, PhD theses are somewhere between


a recompilation of previously published papers with an introduction and a conclusion and possibly with some additional content that did not fit into publications,
just a collection of published papers.


This is particularly likely to apply if the thesis is not to be found in a published form.
So, the more important results of a PhD work are likely to be published.

This doesn’t make it invalid to ask for the thesis, but it may be worth checking what that person published during their PhD time before asking.
This way you can establish whether you are actually interested in the thesis and what parts you are interested in.
Depending on the field, it is rather uncommon that somebody is really interested in an entire thesis, and not just a certain aspect.
Hence a more specific request including why you are interested in the thesis or what specific aspects you want to know about is more likely to gain you what you need.
Usually, the author can directly tell you, which chapters or sections are relevant to you.


For example, the most interesting content that is exclusive to my thesis is a brief review of the general topic in the introduction.
The requirement of publishing my thesis was waived because all essential parts were already published.
If somebody wrote me a mail just asking for my thesis, I would ask them what part or aspect they are interested in and then send them the corresponding paper(s).