Yes. While they’re traditionally used outdoors, in garden spaces, golf nets are just as easy to use indoors if you have a suitable area for one.
A spare room or a garage would do the trick nicely. As long as you have room to swing your club freely without catching anything around you, and as long as you account for the size of the net and the impact of the ball, you’re good to go.
Always play cautiously, though! For more information on the dimensions of your chosen golf net, be sure to read the product description thoroughly.