It seems that lawyers can (and do) act for family and friends so long as:
“the practitioner reasonably expects to serve the client honestly and fairly, and with competence and diligence” (example from the
Law Institute of Victoria Professional Conduct and Practice Rules). You can also have a look at the
NSW professional conduct rules, etc, there are similar rules in each State that you can check depending on where you're based.
I would have thought the issue would be whether the lawyer has the skill and knowledge to competently represent the client in a Family Law matter if they only practice in Criminal Law. But that is up to the lawyer to know whether they have the requisite skills and knowledge to competently represent their client.