I'm going to start out by saying don't do it.
That being said it can be done, usually involving a couple senarios.
1. One betta spends all it's time hiding (bad)
2. Two well tempered males are kept next to eachother with dividers for a long period of time and it's eventually removed after a amount of time (risky)
3. Males (usually more then 2 from same batch) that are kept together since they were fry (usually in a small tank) sometimes don't fight because there isn't any territory for them to win anyway (gotta raise them from fry, and it's still risky)
and they only way I'd recommend:
4. If you had a large tank with a large foot print with lots of caves, plants and other objects to break lines of site you could house multiple males and females in together. This is because the males would be able to establish their own territories with enough room between to prevent fighting. (Lots of money, time, effort and still not recommended for except for advanced keepers who have done their research. )
So in conclusion if the stars aline for the mentioned ways it is possible but in my opinion if you are at the point in fish keeping where you need to ask that question it's not a good idea. Way 1,2, and 3 are cruel IMO, and the 4th way would be a rather large project. This is my opinion from doing a lot of reading on betta and just tropical fish in general. It can be done but unless you are really dedicated to it shouldn't be.