Yes, it's possible, but it's not particularly easy. Unlike creating fields which you can utilize the "CRUD" based metadata api calls, profiles require using retrieve and deploy calls. This means you'll have to deal with zipping and unzipping the data for the deploy/retrieve calls, constructing the xml for the package manifest to do the retrieve call, and dealing with modifying the resulting xml. I'm not aware of any sample code for this unfortunately.
High Level Steps
1. List out Profiles
You'll need to list out all the profiles that you want to update the field level security for
2. Construct your Project Manifest
Build a package.xml that includes all profiles from step 1, and any fields you want to set the security for. Profiles only include permissions related to the other components in the next step, so you must retrieve them in conjunction with any components you're update the security for.
3. Do a retrieve call and unzip the result
Use your project manifest to do a retrieve call and unzip the resulting zip file.
4. Update the permissions
Update the profile XML with the desired permissions
5. Deploy the changes
Zip everything back up and do a deploy call.