If there is a flint lock that will fit the existing mortise, or the lock is larger than the existing one AND
if the current ignition is drum style AND the new lock pan would line up with the hole
OR
if the barrel has a hooked breech, whether snail or drum style and the plug can be replaced AND in replacing the plug you don't alter the position of the barrel so far as the wedges or pins will no longer fasten it to the stock OR you can move them
Then Yes, it can be done.
Now, depending on "what rifle" you would be attempting to convert, the cost of doing such may be somewhat more than the cost of simply replacing the rifle.
Some are built with the ability to convert taken into account - most are not.
But throw enough money at any given problem and it can be done.