Things are going wrong here, horribly:
I have software that only works with Windows XP.
Okay. That tends to happen from time to time.
I have a computer that runs Windows XP.
That is good, because of the need to run the software, probably.
It has a firewall and up-to-date antivirus software.
That is nice, but a firewall would only be needed if that XP box was networked. And you shouldn't connect an XP machine to any network that is not air gapped at this point. Even air gapped networks pose risks as other machines could be used to pivot (and be it from inside threats).
Though I have several other computers running Windows 7, I have never "networked" them to the XP computer. They only use the same wifi connection as the XP computer.
So you're saying you didn't network them, they are only in the same network? I'm not sure whether you understand what "networking" is meant to mean.
Stop networking your XP box. Right now.
I want to use the XP computer for the outdated software and to occasionally go online.
Nope. You do never want to go online with that machine.
What are the risks?
Complete and utter compromise of your XP box and possibly your whole network, both with a high probability.
If I only visit safe websites, am I still in danger? Is there any danger to my other computers?
That depends what you mean by safe websites, but there is a high probability that those use ads - and ad campaigns can be used to deliver drive by exploits that Windows XP is no longer getting any patches for.
As the comments suggested: there are even more risks, which I opted to preclude with presuming your firewall was watertight and you only browsed safe pages and read no mails and had no office installed etc.
All of my presumptions are probably not true.
Let me make this clear: you shouldn’t network an XP machine at this point - at all. Not even just for browsing “safe” websites, not even with a watertight firewall.