No, not usually. Most airlines are part of one of the three major alliances; OneWorld, Star Alliance, or SkyTeam.If the airline that you have miles with is part of an alliance, you will be able to use those miles to fly on the other partners in that alliance.
For example, let’s say you want to fly from New York to Madrid and you have AA miles. AA does not operate this route, but Iberia does. Iberia and AA are both part of the OneWorld Alliance, and therefore, you can use your AA miles to fly with Iberia.