This is one of the hallmarks of evolution.
How do you think wings evolved? By repurposing an appendage that was already had a purpose other than flight.