What are the rules in baseball regarding the frequency and number of times a player can be optioned back and forth from the parent major league team and the minor leagues?
The high points:
If a player is sent to the minors for more than 20 days in a season, that is an "option"able assignment.
Teams are normally permitted to do this up to 3 times (years) for a player. So a player that goes up and down his first 3 years in the league will be "out of options". If the team doesn't need the player on the major league roster, and the player doesn't have a remaining option, they would have to release him, trade him, or allow other teams to acquire him (place him on waivers).
There is no limit* to the number of times a player can sent back and forth in a season that their option is exercised, but they normally have to remain on the minor-league roster for 10 days once sent down.
After 5 years in the league, the player has the right to refuse option assignments (even if options remain).
There are several other infrequent cases possible. I don't know of any official MLB public page that shows all of the exact rules. This Cubs page has a good description of how this works and has a lot more detail.
[*] MLB announced that beginning with the 2023 season, players would be limited to 5 optional assignments in one year without having to clear waivers.