Same applies to journalists. They write stories about many domains. What about graphic artists, too? Any occupation that works with other occupations has the same problem. You need to work with people who understand that domain: a domain expert.
Writers of software do not need to be experts, but they need access to experts. Those experts work with a person responsible for recording how the application should behave, and the problems it should solve. This person goes by many titles, but you will commonly here them referred to as a Business Analyst.
The business analyst might be a domain expert, but more likely the business analyst knows of one or more domain experts with whom they interact in order to gather requirements.
For example, I play the role of a business analyst on a project (among many other roles, but that's too big for this question). The application I gather requirements for serves the vocational rehabilitation industry (help people get and retain employment).
I am not a vocational rehab expert. I work with a number of people who are experts in this field. They actually do vocational rehab, so they tell me about the problems they have and we come up with software solutions. I organize the work so developers and testers can build the software without becoming vocational rehab expert themselves.
Addendum: As someone who writes software, your domain is software development. I would expect you to be a domain expert on developing software, but not an expert on the domain the software is written for.
UPDATE : I see comparison made with journalists. I think that journalism is not a good example. Often the journalist writes on a topic he/she does not understand and it comes of as superficial (sometimes even wrong).
The same thing happens when writing software too. When you lack access to a domain expert, the developer writes software about a topic he/she does not understand, and it comes off as superficial (sometimes even wrong).