does it necessarily mean "sexual unfaithfulness" or can it also mean the breach of some moral obligation in a friendship?
It means neither. This is the meaning of "niewiara":
sjp.pwn.pl/slowniki/niewiara.html
1. not believing in religious dogmas
2. lack of faith in something, lack of trust towards someone, something